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 (
    101305, 101306, 101307, 101308, 101309, 
    101310, 101311, 101312, 101313, 101314, 
    101315, 101316, 101317, 101318, 101319, 
    101320, 101321, 101322, 101323, 101324, 
    101325, 101326, 101327, 101328, 101329, 
    101330, 101331, 101332, 101333, 101334, 
    101335, 101336, 101337, 101338, 101339, 
    101340, 101341, 101342, 101343, 101344, 
    101345, 101346, 101347, 101348, 101349, 
    101350, 101351, 101352, 101353, 101354, 
    101355, 101356, 101357, 101358, 101359, 
    101360, 101361, 101362, 101363, 101364, 
    101365, 101366, 101367, 101368, 101369, 
    101370, 101371, 101372, 101373, 101374, 
    101375, 101376, 101377, 101378, 101379, 
    101380, 101381, 101382, 101383, 101384, 
    101385, 101386, 101387, 101388, 101389, 
    101390, 101391, 101392, 101393, 101394, 
    101395, 101396, 101397, 101398, 101399, 
    101400
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00194

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 (101305,101306,101307,101308,101309,101310,101311,101312,101313,101314,101315,101316,101317,101318,101319,101320,101321,101322,101323,101324,101325,101326,101327,101328,101329,101330,101331,101332,101333,101334,101335,101336,101337,101338,101339,101340,101341,101342,101343,101344,101345,101346,101347,101348,101349,101350,101351,101352,101353,101354,101355,101356,101357,101358,101359,101360,101361,101362,101363,101364,101365,101366,101367,101368,101369,101370,101371,101372,101373,101374,101375,101376,101377,101378,101379,101380,101381,101382,101383,101384,101385,101386,101387,101388,101389,101390,101391,101392,101393,101394,101395,101396,101397,101398,101399,101400))"
          }
        },
        {
          "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
101305 7200M 0
101306 7200M 0
101307 7200M 0
101308 7200M 0
101309 7200M 0
101310 7200M 0
101311 7200M 0
101312 7200M 0
101313 7200M 0
101314 7200M 0
101315 7200M 0
101316 7200M 0
101317 7200M 0
101318 7200M 0
101319 7200M 0
101320 7200M 0
101321 7200M 0
101322 7200M 0
101323 7200M 0
101324 7200M 0
101325 7200M 0
101326 7200M 0
101327 7200M 0
101328 7200M 0
101329 7200M 0
101330 7200M 0
101331 7200M 0
101332 7200M 0
101333 7200M 0
101334 7200M 0
101335 7200M 0
101336 7200M 0
101337 7200M 0
101338 7200M 0
101339 7200M 0
101340 7200M 0
101341 7200M 0
101342 7200M 0
101343 7200M 0
101344 7200M 0
101345 7200M 0
101346 7200M 0
101347 7200M 0
101348 7200M 0
101349 7200M 0
101350 7200M 0
101351 7200M 0
101352 7200M 0
101353 7200M 0
101354 7200M 0
101355 7200M 0
101356 7200M 0
101357 7200M 0
101358 7200M 0
101359 7200M 0
101360 7200M 0
101361 7200M 0
101362 7200M 0
101363 7200M 0
101364 7200M 0
101365 7200M 0
101366 7200M 0
101367 7200M 0
101368 7200M 0
101369 7200M 0
101370 7200M 0
101371 7200M 0
101372 7200M 0
101373 7200M 0
101374 7200M 0
101375 7200M 0
101376 7200M 0
101377 7200M 0
101378 7200M 0
101379 7200M 0
101380 7200M 0
101381 7200M 0
101382 7200M 0
101383 7200M 0
101384 7200M 0
101385 7200M 0
101386 7200M 0
101387 7200M 0
101388 7200M 0
101389 7200M 0
101390 7200M 0
101391 7200M 0
101392 7200M 0
101393 7200M 0
101394 7200M 0
101395 7200M 0
101396 7200M 0
101397 7200M 0
101398 7200M 0
101399 7200M 0
101400 7200M 0