SELECT 
  cscart_products_categories.product_id, 
  GROUP_CONCAT(
    IF(
      cscart_products_categories.link_type = "M", 
      CONCAT(
        cscart_products_categories.category_id, 
        "M"
      ), 
      cscart_products_categories.category_id
    )
  ) AS category_ids, 
  product_position_source.position AS position 
FROM 
  cscart_products_categories 
  INNER JOIN cscart_categories ON cscart_categories.category_id = cscart_products_categories.category_id 
  AND cscart_categories.storefront_id IN (0, 1) 
  AND (
    cscart_categories.usergroup_ids = '' 
    OR FIND_IN_SET(
      0, cscart_categories.usergroup_ids
    ) 
    OR FIND_IN_SET(
      1, cscart_categories.usergroup_ids
    )
  ) 
  AND cscart_categories.status IN ('A', 'H') 
  LEFT JOIN cscart_products_categories AS product_position_source ON cscart_products_categories.product_id = product_position_source.product_id 
  AND product_position_source.category_id = 7200 
WHERE 
  cscart_products_categories.product_id IN (
    101401, 101402, 101403, 101404, 101405, 
    101406, 101407, 101408, 101409, 101410, 
    101411, 101412, 101413, 101414, 101415, 
    101416, 101417, 101418, 101419, 101420, 
    101421, 101422, 101423, 101424, 101425, 
    101426, 101427, 101428, 101429, 101430, 
    101431, 101432, 101433, 101434, 101435, 
    101436, 101437, 101438, 101439, 101440, 
    101441, 101442, 101443, 101444, 101445, 
    101446, 101447, 101448, 101449, 101450, 
    101451, 101452, 101453, 101454, 101455, 
    101456, 101457, 101458, 101459, 101460, 
    101461, 101462, 101463, 101464, 101465, 
    101466, 101467, 101468, 101469, 101470, 
    101471, 101472, 101473, 101474, 101475, 
    101476, 101477, 101478, 101479, 101480, 
    101481, 101482, 101483, 101484, 101485, 
    101486, 101487, 101488, 101489, 101490, 
    101491, 101492, 101493, 101494, 101495, 
    101496
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00232

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "54.77"
    },
    "grouping_operation": {
      "using_filesort": false,
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_products_categories",
            "access_type": "range",
            "possible_keys": [
              "PRIMARY",
              "link_type",
              "pt"
            ],
            "key": "pt",
            "used_key_parts": [
              "product_id"
            ],
            "key_length": "3",
            "rows_examined_per_scan": 96,
            "rows_produced_per_join": 96,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "9.89",
              "eval_cost": "9.60",
              "prefix_cost": "19.49",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (101401,101402,101403,101404,101405,101406,101407,101408,101409,101410,101411,101412,101413,101414,101415,101416,101417,101418,101419,101420,101421,101422,101423,101424,101425,101426,101427,101428,101429,101430,101431,101432,101433,101434,101435,101436,101437,101438,101439,101440,101441,101442,101443,101444,101445,101446,101447,101448,101449,101450,101451,101452,101453,101454,101455,101456,101457,101458,101459,101460,101461,101462,101463,101464,101465,101466,101467,101468,101469,101470,101471,101472,101473,101474,101475,101476,101477,101478,101479,101480,101481,101482,101483,101484,101485,101486,101487,101488,101489,101490,101491,101492,101493,101494,101495,101496))"
          }
        },
        {
          "table": {
            "table_name": "cscart_categories",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY",
              "c_status",
              "p_category_id"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id"
            ],
            "key_length": "3",
            "ref": [
              "nuie_scalesta_net.cscart_products_categories.category_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 4,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "24.00",
              "eval_cost": "0.48",
              "prefix_cost": "53.09",
              "data_read_per_join": "12K"
            },
            "used_columns": [
              "category_id",
              "usergroup_ids",
              "status",
              "storefront_id"
            ],
            "attached_condition": "((`nuie_scalesta_net`.`cscart_categories`.`storefront_id` in (0,1)) and ((`nuie_scalesta_net`.`cscart_categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`nuie_scalesta_net`.`cscart_categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`nuie_scalesta_net`.`cscart_categories`.`usergroup_ids`))) and (`nuie_scalesta_net`.`cscart_categories`.`status` in ('A','H')))"
          }
        },
        {
          "table": {
            "table_name": "product_position_source",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY",
              "pt"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id",
              "product_id"
            ],
            "key_length": "6",
            "ref": [
              "const",
              "nuie_scalesta_net.cscart_products_categories.product_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 4,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "1.20",
              "eval_cost": "0.48",
              "prefix_cost": "54.77",
              "data_read_per_join": "76"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
101401 7200M 0
101402 7200M 0
101403 7200M 0
101404 7200M 0
101405 7200M 0
101406 7200M 0
101407 7200M 0
101408 7200M 0
101409 7200M 0
101410 7200M 0
101411 7200M 0
101412 7200M 0
101413 7200M 0
101414 7200M 0
101415 7200M 0
101416 7200M 0
101417 7200M 0
101418 7200M 0
101419 7200M 0
101420 7200M 0
101421 7200M 0
101422 7200M 0
101423 7200M 0
101424 7200M 0
101425 7200M 0
101426 7200M 0
101427 7200M 0
101428 7200M 0
101429 7200M 0
101430 7200M 0
101431 7200M 0
101432 7200M 0
101433 7200M 0
101434 7200M 0
101435 7200M 0
101436 7200M 0
101437 7200M 0
101438 7200M 0
101439 7200M 0
101440 7200M 0
101441 7200M 0
101442 7200M 0
101443 7200M 0
101444 7200M 0
101445 7200M 0
101446 7200M 0
101447 7200M 0
101448 7200M 0
101449 7200M 0
101450 7200M 0
101451 7200M 0
101452 7200M 0
101453 7200M 0
101454 7200M 0
101455 7200M 0
101456 7200M 0
101457 7200M 0
101458 7200M 0
101459 7200M 0
101460 7200M 0
101461 7200M 0
101462 7200M 0
101463 7200M 0
101464 7200M 0
101465 7200M 0
101466 7200M 0
101467 7200M 0
101468 7200M 0
101469 7200M 0
101470 7200M 0
101471 7200M 0
101472 7200M 0
101473 7200M 0
101474 7200M 0
101475 7200M 0
101476 7200M 0
101477 7200M 0
101478 7200M 0
101479 7200M 0
101480 7200M 0
101481 7200M 0
101482 7200M 0
101483 7200M 0
101484 7200M 0
101485 7200M 0
101486 7200M 0
101487 7200M 0
101488 7200M 0
101489 7200M 0
101490 7200M 0
101491 7200M 0
101492 7200M 0
101493 7200M 0
101494 7200M 0
101495 7200M 0
101496 7200M 0