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 = 266 
WHERE 
  cscart_products_categories.product_id IN (
    430726, 431012, 431056, 431186, 430793, 
    430799, 431392, 430683, 431034, 431301, 
    431354, 431504, 430877, 430879, 431166, 
    431289, 431334, 430926, 430946, 431344, 
    430659, 430920, 430997, 431000, 431020, 
    431218, 431244, 431406, 430706, 430741, 
    430864, 431021, 431291, 431309, 431322, 
    431368, 431487, 430792, 430858, 430882, 
    431248, 431252, 431280, 339481, 430761, 
    430830, 431230, 431349, 431429, 431469, 
    430919, 430949, 430975, 431038, 431101, 
    431295, 431303, 431360, 431376, 431420, 
    431464, 430642, 430740, 431410, 431424, 
    430671, 431470, 430739, 430867, 430957, 
    431047, 431055, 431060, 431279, 431474, 
    430643, 430679, 431211, 431341, 431350, 
    430735, 430814, 430948, 431237, 392168, 
    431246, 430734, 430764, 430798, 431234, 
    431287, 430934, 430982, 431010, 431149, 
    431273, 431324, 430667, 430718, 430754
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00231

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "281.15"
    },
    "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": 100,
            "rows_produced_per_join": 100,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "21.15",
              "eval_cost": "20.00",
              "prefix_cost": "41.15",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`webmarco`.`cscart_products_categories`.`product_id` in (430726,431012,431056,431186,430793,430799,431392,430683,431034,431301,431354,431504,430877,430879,431166,431289,431334,430926,430946,431344,430659,430920,430997,431000,431020,431218,431244,431406,430706,430741,430864,431021,431291,431309,431322,431368,431487,430792,430858,430882,431248,431252,431280,339481,430761,430830,431230,431349,431429,431469,430919,430949,430975,431038,431101,431295,431303,431360,431376,431420,431464,430642,430740,431410,431424,430671,431470,430739,430867,430957,431047,431055,431060,431279,431474,430643,430679,431211,431341,431350,430735,430814,430948,431237,392168,431246,430734,430764,430798,431234,431287,430934,430982,431010,431149,431273,431324,430667,430718,430754))"
          }
        },
        {
          "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": 100,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "100.00",
              "eval_cost": "20.00",
              "prefix_cost": "161.15",
              "data_read_per_join": "1K"
            },
            "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": 5,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "100.00",
              "eval_cost": "1.00",
              "prefix_cost": "281.15",
              "data_read_per_join": "29K"
            },
            "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
339481 9940M
392168 2577M
430642 2601M
430643 2601M
430659 2601M
430667 2601M
430671 2601M
430679 2601M
430683 2601M
430706 2601M
430718 2601M
430726 2601M
430734 2601M
430735 2601M
430739 2601M
430740 2601M
430741 2601M
430754 2601M
430761 2601M
430764 2601M
430792 2601M
430793 2601M
430798 2601M
430799 2601M
430814 2601M
430830 2601M
430858 2601M
430864 2601M
430867 2601M
430877 2601M
430879 2601M
430882 2601M
430919 2601M
430920 2601M
430926 2601M
430934 2601M
430946 2601M
430948 2601M
430949 2601M
430957 2601M
430975 2601M
430982 2601M
430997 2601M
431000 2601M
431010 2601M
431012 2601M
431020 2601M
431021 2601M
431034 2601M
431038 2601M
431047 2601M
431055 2601M
431056 2601M
431060 2601M
431101 2601M
431149 2601M
431166 2601M
431186 2601M
431211 2601M
431218 2601M
431230 2601M
431234 2601M
431237 2601M
431244 2601M
431246 2601M
431248 2601M
431252 2601M
431273 2601M
431279 2601M
431280 2601M
431287 2601M
431289 2601M
431291 2601M
431295 2601M
431301 2601M
431303 2601M
431309 2601M
431322 2601M
431324 2601M
431334 2601M
431341 2601M
431344 2601M
431349 2601M
431350 2601M
431354 2601M
431360 2601M
431368 2601M
431376 2601M
431392 2601M
431406 2601M
431410 2601M
431420 2601M
431424 2601M
431429 2601M
431464 2601M
431469 2601M
431470 2601M
431474 2601M
431487 2601M
431504 2601M