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 (
    430732, 430833, 430942, 430985, 431076, 
    431466, 431480, 339768, 387046, 430750, 
    431210, 431219, 431330, 431438, 431452, 
    430719, 431380, 430724, 430987, 431181, 
    431222, 431285, 431377, 431481, 431239, 
    431353, 431387, 381709, 430693, 431229, 
    431241, 431412, 431447, 430632, 430727, 
    431292, 431384, 431385, 431440, 431502, 
    431208, 431236, 430733, 431188, 431281, 
    430721, 430682, 431259, 431224, 431335, 
    431361, 430699, 431421, 430701, 430955, 
    431249, 431253, 431332, 431458, 430951, 
    431040, 431081, 431172, 431402, 430731, 
    430757, 431431, 430945, 431009, 431143, 
    431215, 431263, 431298, 431468, 381715, 
    430736, 431170, 431442, 431455, 431472, 
    381706, 431364, 431401, 431414, 431478, 
    430970, 431180, 431454, 381708, 430941, 
    430954, 431233, 431369, 431378, 431446, 
    430725, 431014, 431213, 431225, 431300
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00230

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 (430732,430833,430942,430985,431076,431466,431480,339768,387046,430750,431210,431219,431330,431438,431452,430719,431380,430724,430987,431181,431222,431285,431377,431481,431239,431353,431387,381709,430693,431229,431241,431412,431447,430632,430727,431292,431384,431385,431440,431502,431208,431236,430733,431188,431281,430721,430682,431259,431224,431335,431361,430699,431421,430701,430955,431249,431253,431332,431458,430951,431040,431081,431172,431402,430731,430757,431431,430945,431009,431143,431215,431263,431298,431468,381715,430736,431170,431442,431455,431472,381706,431364,431401,431414,431478,430970,431180,431454,381708,430941,430954,431233,431369,431378,431446,430725,431014,431213,431225,431300))"
          }
        },
        {
          "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
381706 2578M
381708 2578M
381709 2578M
381715 2578M
387046 2578M
430632 2601M
430682 2601M
430693 2601M
430699 2601M
430701 2601M
430719 2601M
430721 2601M
430724 2601M
430725 2601M
430727 2601M
430731 2601M
430732 2601M
430733 2601M
430736 2601M
430750 2601M
430757 2601M
430833 2601M
430941 2601M
430942 2601M
430945 2601M
430951 2601M
430954 2601M
430955 2601M
430970 2601M
430985 2601M
430987 2601M
431009 2601M
431014 2601M
431040 2601M
431076 2601M
431081 2601M
431143 2601M
431170 2601M
431172 2601M
431180 2601M
431181 2601M
431188 2601M
431208 2601M
431210 2601M
431213 2601M
431215 2601M
431219 2601M
431222 2601M
431224 2601M
431225 2601M
431229 2601M
431233 2601M
431236 2601M
431239 2601M
431241 2601M
431249 2601M
431253 2601M
431259 2601M
431263 2601M
431281 2601M
431285 2601M
431292 2601M
431298 2601M
431300 2601M
431330 2601M
431332 2601M
431335 2601M
431353 2601M
431361 2601M
431364 2601M
431369 2601M
431377 2601M
431378 2601M
431380 2601M
431384 2601M
431385 2601M
431387 2601M
431401 2601M
431402 2601M
431412 2601M
431414 2601M
431421 2601M
431431 2601M
431438 2601M
431440 2601M
431442 2601M
431446 2601M
431447 2601M
431452 2601M
431454 2601M
431455 2601M
431458 2601M
431466 2601M
431468 2601M
431472 2601M
431478 2601M
431480 2601M
431481 2601M
431502 2601M