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 = 2913 
WHERE 
  cscart_products_categories.product_id IN (
    366926, 366913, 366931, 366914, 366929, 
    366928, 366927, 366936, 366937, 368738, 
    366940, 366915, 368731, 368839, 366930, 
    368772, 366933, 366934, 368698, 368735, 
    366939, 366932, 368733, 366942, 368677, 
    366949, 368770, 368734, 368730, 368716, 
    368829, 368783, 368798, 368740, 366948, 
    368822, 368750, 366947, 366943, 368795, 
    368818, 366938, 368714, 368742, 368715, 
    368797, 366941, 368827, 366950, 368718, 
    368823, 350398, 350316, 355400, 355448, 
    350217, 350261, 350356, 350219, 350578, 
    350251, 355391, 350477, 356841, 350526, 
    350585, 350202, 350542, 350537, 350208, 
    350484, 350212, 353704, 350323, 350539, 
    350211, 350553, 353714, 350510, 350416, 
    350204, 350459, 350213, 350207, 350222, 
    350455, 350225, 350198, 350392, 355393, 
    350505, 350580, 350518, 350528, 355591, 
    353706, 350584, 350320, 350406, 350214
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00294

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "376.40"
    },
    "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": 134,
            "rows_produced_per_join": 134,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "28.00",
              "eval_cost": "26.80",
              "prefix_cost": "54.80",
              "data_read_per_join": "2K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`webmarco`.`cscart_products_categories`.`product_id` in (366926,366913,366931,366914,366929,366928,366927,366936,366937,368738,366940,366915,368731,368839,366930,368772,366933,366934,368698,368735,366939,366932,368733,366942,368677,366949,368770,368734,368730,368716,368829,368783,368798,368740,366948,368822,368750,366947,366943,368795,368818,366938,368714,368742,368715,368797,366941,368827,366950,368718,368823,350398,350316,355400,355448,350217,350261,350356,350219,350578,350251,355391,350477,356841,350526,350585,350202,350542,350537,350208,350484,350212,353704,350323,350539,350211,350553,353714,350510,350416,350204,350459,350213,350207,350222,350455,350225,350198,350392,355393,350505,350580,350518,350528,355591,353706,350584,350320,350406,350214))"
          }
        },
        {
          "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",
              "webmarco.cscart_products_categories.product_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 134,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "134.00",
              "eval_cost": "26.80",
              "prefix_cost": "215.60",
              "data_read_per_join": "2K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        },
        {
          "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": [
              "webmarco.cscart_products_categories.category_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 6,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "134.00",
              "eval_cost": "1.34",
              "prefix_cost": "376.40",
              "data_read_per_join": "39K"
            },
            "used_columns": [
              "category_id",
              "usergroup_ids",
              "status",
              "storefront_id"
            ],
            "attached_condition": "((`webmarco`.`cscart_categories`.`storefront_id` in (0,1)) and ((`webmarco`.`cscart_categories`.`usergroup_ids` = '') or find_in_set(0,`webmarco`.`cscart_categories`.`usergroup_ids`) or find_in_set(1,`webmarco`.`cscart_categories`.`usergroup_ids`)) and (`webmarco`.`cscart_categories`.`status` in ('A','H')))"
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
350198 2913M 0
350202 2913M 0
350204 2913M 0
350207 2913M 0
350208 2913M 0
350211 2913M 0
350212 2913M 0
350213 2913M 0
350214 2913M 0
350217 2913M 0
350219 2913M 0
350222 2913M 0
350225 2913M 0
350251 2913M 0
350261 2913M 0
350316 2913M 0
350320 2913M 0
350323 2913M 0
350356 2913M 0
350392 2913M 0
350398 2913M 0
350406 2913M 0
350416 2913M 0
350455 2913M 0
350459 2913M 0
350477 2913M 0
350484 2913M 0
350505 2913M 0
350510 2913M 0
350518 2913M 0
350526 2913M 0
350528 2913M 0
350537 2913M 0
350539 2913M 0
350542 2913M 0
350553 2913M 0
350578 2913M 0
350580 2913M 0
350584 2913M 0
350585 2913M 0
353704 2913M 0
353706 2913M 0
353714 2913M 0
355391 2913M 0
355393 2913M 0
355400 2913M 0
355448 2913M 0
355591 2913M 0
356841 2913M 0
366913 2913,2910M 0
366914 2913,2910M 0
366915 2913,2910M 0
366926 2913,2920,2910M 0
366927 2913,2920,2910M 0
366928 2913,2920,2910M 0
366929 2913,2920,2910M 0
366930 2913,2920,2910M 0
366931 2913,2920,2910M 0
366932 2913,2910M 0
366933 2913,2910M 0
366934 2913,2910M 0
366936 2913,2910M 0
366937 2913,2910M 0
366938 2913,2910M 0
366939 2913,2910M 0
366940 2913,2910M 0
366941 2913,2910M 0
366942 2913,2910M 0
366943 2913,2910M 0
366947 2913,2920,2910M 0
366948 2913,2920,2910M 0
366949 2913,2920,2910M 0
366950 2913,2920,2910M 0
368677 2913M 0
368698 2913M 0
368714 2913M 0
368715 2913M 0
368716 2913M 0
368718 2913M 0
368730 2913M 0
368731 2913M 0
368733 2913M 0
368734 2913M 0
368735 2913M 0
368738 2913M 0
368740 2913M 0
368742 2913M 0
368750 2913M 0
368770 2913M 0
368772 2913M 0
368783 2913M 0
368795 2913M 0
368797 2913M 0
368798 2913M 0
368818 2913M 0
368822 2913M 0
368823 2913M 0
368827 2913M 0
368829 2913M 0
368839 2913M 0