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 (
    430938, 431208, 431241, 431335, 431447, 
    430727, 430973, 430985, 431292, 430752, 
    430757, 430942, 431383, 431488, 431502, 
    430978, 431017, 431210, 431236, 431330, 
    430719, 430929, 431227, 431235, 431427, 
    431466, 430630, 430632, 431263, 431482, 
    430943, 431040, 430955, 431415, 431018, 
    431069, 431364, 430693, 430971, 431361, 
    431378, 381708, 431281, 431421, 431302, 
    431385, 431285, 431369, 430717, 430785, 
    431212, 431402, 430725, 430833, 430941, 
    431086, 430736, 430987, 431384, 430724, 
    430733, 431229, 431300, 431377, 431472, 
    430721, 431223, 431253, 431181, 431454, 
    430682, 430951, 430956, 431081, 431431, 
    431225, 431468, 381715, 431387, 431446, 
    430716, 431401, 431438, 431143, 431382, 
    431412, 431430, 431058, 431170, 430945, 
    431215, 431460, 431224, 431294, 431310, 
    431312, 431367, 431450, 339768, 430731
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00181

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 (430938,431208,431241,431335,431447,430727,430973,430985,431292,430752,430757,430942,431383,431488,431502,430978,431017,431210,431236,431330,430719,430929,431227,431235,431427,431466,430630,430632,431263,431482,430943,431040,430955,431415,431018,431069,431364,430693,430971,431361,431378,381708,431281,431421,431302,431385,431285,431369,430717,430785,431212,431402,430725,430833,430941,431086,430736,430987,431384,430724,430733,431229,431300,431377,431472,430721,431223,431253,431181,431454,430682,430951,430956,431081,431431,431225,431468,381715,431387,431446,430716,431401,431438,431143,431382,431412,431430,431058,431170,430945,431215,431460,431224,431294,431310,431312,431367,431450,339768,430731))"
          }
        },
        {
          "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
339768 395M
381708 2578M
381715 2578M
430630 2601M
430632 2601M
430682 2601M
430693 2601M
430716 2601M
430717 2601M
430719 2601M
430721 2601M
430724 2601M
430725 2601M
430727 2601M
430731 2601M
430733 2601M
430736 2601M
430752 2601M
430757 2601M
430785 2601M
430833 2601M
430929 2601M
430938 2601M
430941 2601M
430942 2601M
430943 2601M
430945 2601M
430951 2601M
430955 2601M
430956 2601M
430971 2601M
430973 2601M
430978 2601M
430985 2601M
430987 2601M
431017 2601M
431018 2601M
431040 2601M
431058 2601M
431069 2601M
431081 2601M
431086 2601M
431143 2601M
431170 2601M
431181 2601M
431208 2601M
431210 2601M
431212 2601M
431215 2601M
431223 2601M
431224 2601M
431225 2601M
431227 2601M
431229 2601M
431235 2601M
431236 2601M
431241 2601M
431253 2601M
431263 2601M
431281 2601M
431285 2601M
431292 2601M
431294 2601M
431300 2601M
431302 2601M
431310 2601M
431312 2601M
431330 2601M
431335 2601M
431361 2601M
431364 2601M
431367 2601M
431369 2601M
431377 2601M
431378 2601M
431382 2601M
431383 2601M
431384 2601M
431385 2601M
431387 2601M
431401 2601M
431402 2601M
431412 2601M
431415 2601M
431421 2601M
431427 2601M
431430 2601M
431431 2601M
431438 2601M
431446 2601M
431447 2601M
431450 2601M
431454 2601M
431460 2601M
431466 2601M
431468 2601M
431472 2601M
431482 2601M
431488 2601M
431502 2601M