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 = 306 
WHERE 
  cscart_products_categories.product_id IN (
    10706, 10707, 10708, 10709, 10710, 10711, 
    10712, 10713, 10714, 10715, 10716, 
    10717, 10718, 10719, 10720, 10721, 
    10722, 10723, 10724, 10725, 10726, 
    10727, 10728, 10729, 10730, 10731, 
    10732, 10733, 10734, 10735, 10736, 
    10737, 10738, 10739, 10740, 10741, 
    10742, 10743, 10744, 10745, 10746, 
    10747, 10748, 10749, 10750, 10751, 
    10752, 10753, 10754, 10755, 10756, 
    10757, 10758, 10759, 10880, 10881, 
    10882, 10883, 10884, 10885, 10886, 
    10887, 10888, 10889, 10890, 10891, 
    10892, 10893, 10894, 10895, 10896, 
    10897, 10898, 11320
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00224

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "68.11"
    },
    "grouping_operation": {
      "using_temporary_table": true,
      "using_filesort": true,
      "cost_info": {
        "sort_cost": "1.34"
      },
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_categories",
            "access_type": "ALL",
            "possible_keys": [
              "PRIMARY",
              "c_status",
              "p_category_id"
            ],
            "rows_examined_per_scan": 40,
            "rows_produced_per_join": 1,
            "filtered": "4.00",
            "cost_info": {
              "read_cost": "4.54",
              "eval_cost": "0.16",
              "prefix_cost": "4.70",
              "data_read_per_join": "6K"
            },
            "used_columns": [
              "category_id",
              "storefront_id",
              "usergroup_ids",
              "status"
            ],
            "attached_condition": "((`gaseus`.`cscart_categories`.`storefront_id` in (0,1)) and ((`gaseus`.`cscart_categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`gaseus`.`cscart_categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`gaseus`.`cscart_categories`.`usergroup_ids`))) and (`gaseus`.`cscart_categories`.`status` in ('A','H')))"
          }
        },
        {
          "table": {
            "table_name": "cscart_products_categories",
            "access_type": "ref",
            "possible_keys": [
              "PRIMARY",
              "pt"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id"
            ],
            "key_length": "3",
            "ref": [
              "gaseus.cscart_categories.category_id"
            ],
            "rows_examined_per_scan": 110,
            "rows_produced_per_join": 1,
            "filtered": "0.76",
            "index_condition": "(`gaseus`.`cscart_products_categories`.`product_id` in (10706,10707,10708,10709,10710,10711,10712,10713,10714,10715,10716,10717,10718,10719,10720,10721,10722,10723,10724,10725,10726,10727,10728,10729,10730,10731,10732,10733,10734,10735,10736,10737,10738,10739,10740,10741,10742,10743,10744,10745,10746,10747,10748,10749,10750,10751,10752,10753,10754,10755,10756,10757,10758,10759,10880,10881,10882,10883,10884,10885,10886,10887,10888,10889,10890,10891,10892,10893,10894,10895,10896,10897,10898,11320))",
            "cost_info": {
              "read_cost": "44.00",
              "eval_cost": "0.13",
              "prefix_cost": "66.30",
              "data_read_per_join": "21"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ]
          }
        },
        {
          "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",
              "gaseus.cscart_products_categories.product_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 1,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "0.34",
              "eval_cost": "0.13",
              "prefix_cost": "66.77",
              "data_read_per_join": "21"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
10706 306M 0
10707 306M 0
10708 306M 0
10709 306M 0
10710 306M 0
10711 306M 0
10712 306M 0
10713 306M 0
10714 306M 0
10715 306M 0
10716 306M 0
10717 306M 0
10718 306M 0
10719 306M 0
10720 306M 0
10721 306M 0
10722 306M 0
10723 306M 0
10724 306M 0
10725 306M 0
10726 306M 0
10727 306M 0
10728 306M 0
10729 306M 0
10730 306M 0
10731 306M 0
10732 306M 0
10733 306M 0
10734 306M 0
10735 306M 0
10736 306M 0
10737 306M 0
10738 306M 0
10739 306M 0
10740 306M 0
10741 306M 0
10742 306M 0
10743 306M 0
10744 306M 0
10745 306M 0
10746 306M 0
10747 306M 0
10748 306M 0
10749 306M 0
10750 306M 0
10751 306M 0
10752 306M 0
10753 306M 0
10754 306M 0
10755 306M 0
10756 306M 0
10757 306M 0
10758 306M 0
10759 306M 0
10880 306M 0
10881 306M 0
10882 306M 0
10883 306M 0
10884 306M 0
10885 306M 0
10886 306M 0
10887 306M 0
10888 306M 0
10889 306M 0
10890 306M 0
10891 306M 0
10892 306M 0
10893 306M 0
10894 306M 0
10895 306M 0
10896 306M 0
10897 306M 0
10898 306M 0
11320 306M 0