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 (
    430866, 430910, 431046, 431131, 431291, 
    381713, 339691, 430896, 430932, 431185, 
    431220, 431333, 431501, 430631, 430653, 
    430730, 430887, 430900, 431072, 431205, 
    431345, 430885, 430999, 431338, 430634, 
    430645, 430761, 430862, 430937, 430992, 
    431054, 431140, 431316, 381711, 339733, 
    339804, 430708, 430870, 431077, 431326, 
    339600, 339781, 430677, 430738, 430994, 
    339831, 430714, 430749, 430797, 430853, 
    430865, 430881, 431365, 430947, 431024, 
    431192, 431463, 430802, 430873, 430936, 
    431242, 430656, 430993, 431395, 431429, 
    339488, 430846, 430960, 431019, 431039, 
    431061, 430626, 430707, 430836, 430969, 
    431003, 431011, 431052, 431322, 430652, 
    430704, 430841, 430905, 430984, 431091, 
    431248, 431315, 430810, 431051, 431113, 
    431503, 430837, 430861, 431074, 431200, 
    431247, 431439, 431178, 431252, 431487
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00294

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 (430866,430910,431046,431131,431291,381713,339691,430896,430932,431185,431220,431333,431501,430631,430653,430730,430887,430900,431072,431205,431345,430885,430999,431338,430634,430645,430761,430862,430937,430992,431054,431140,431316,381711,339733,339804,430708,430870,431077,431326,339600,339781,430677,430738,430994,339831,430714,430749,430797,430853,430865,430881,431365,430947,431024,431192,431463,430802,430873,430936,431242,430656,430993,431395,431429,339488,430846,430960,431019,431039,431061,430626,430707,430836,430969,431003,431011,431052,431322,430652,430704,430841,430905,430984,431091,431248,431315,430810,431051,431113,431503,430837,430861,431074,431200,431247,431439,431178,431252,431487))"
          }
        },
        {
          "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
339488 9940M
339600 395M
339691 395M
339733 395M
339781 395M
339804 9943M
339831 395M
381711 2578M
381713 2578M
430626 2601M
430631 2601M
430634 2601M
430645 2601M
430652 2601M
430653 2601M
430656 2601M
430677 2601M
430704 2601M
430707 2601M
430708 2601M
430714 2601M
430730 2601M
430738 2601M
430749 2601M
430761 2601M
430797 2601M
430802 2601M
430810 2601M
430836 2601M
430837 2601M
430841 2601M
430846 2601M
430853 2601M
430861 2601M
430862 2601M
430865 2601M
430866 2601M
430870 2601M
430873 2601M
430881 2601M
430885 2601M
430887 2601M
430896 2601M
430900 2601M
430905 2601M
430910 2601M
430932 2601M
430936 2601M
430937 2601M
430947 2601M
430960 2601M
430969 2601M
430984 2601M
430992 2601M
430993 2601M
430994 2601M
430999 2601M
431003 2601M
431011 2601M
431019 2601M
431024 2601M
431039 2601M
431046 2601M
431051 2601M
431052 2601M
431054 2601M
431061 2601M
431072 2601M
431074 2601M
431077 2601M
431091 2601M
431113 2601M
431131 2601M
431140 2601M
431178 2601M
431185 2601M
431192 2601M
431200 2601M
431205 2601M
431220 2601M
431242 2601M
431247 2601M
431248 2601M
431252 2601M
431291 2601M
431315 2601M
431316 2601M
431322 2601M
431326 2601M
431333 2601M
431338 2601M
431345 2601M
431365 2601M
431395 2601M
431429 2601M
431439 2601M
431463 2601M
431487 2601M
431501 2601M
431503 2601M