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 = 2601 
WHERE 
  cscart_products_categories.product_id IN (
    430746, 431068, 430813, 430925, 431085, 
    431103, 431163, 431164, 430817, 430654, 
    430902, 431313, 431053, 431148, 430751, 
    431044, 431120, 431456, 430660, 430825, 
    430678, 430680, 430959, 431013, 431127, 
    430691, 430756, 430820, 431109, 431161, 
    430737, 431035, 431041, 431194, 430875, 
    431049, 430819, 431083, 430808, 430989, 
    431080, 430635, 430650, 430629, 430860, 
    431126, 430657, 430807, 430921, 430922, 
    430843, 430812, 430868, 431073, 431144, 
    430789, 430795, 430758, 431082, 430818, 
    430901, 430928, 430950, 431156, 430658, 
    430673, 431110, 430684, 431066, 431114, 
    431118, 430689, 430822, 431064, 430769, 
    430892, 431043, 431169, 430628, 430664, 
    430842, 430834, 430859, 430906, 431459, 
    430768, 430890, 430988, 431183, 431250, 
    431008, 430703, 430838, 430962, 430909, 
    431063, 431159, 430695, 430904, 430923
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00192

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "167.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 (430746,431068,430813,430925,431085,431103,431163,431164,430817,430654,430902,431313,431053,431148,430751,431044,431120,431456,430660,430825,430678,430680,430959,431013,431127,430691,430756,430820,431109,431161,430737,431035,431041,431194,430875,431049,430819,431083,430808,430989,431080,430635,430650,430629,430860,431126,430657,430807,430921,430922,430843,430812,430868,431073,431144,430789,430795,430758,431082,430818,430901,430928,430950,431156,430658,430673,431110,430684,431066,431114,431118,430689,430822,431064,430769,430892,431043,431169,430628,430664,430842,430834,430859,430906,431459,430768,430890,430988,431183,431250,431008,430703,430838,430962,430909,431063,431159,430695,430904,430923))"
          }
        },
        {
          "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": "161.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')))"
          }
        },
        {
          "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": 5,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "5.00",
              "eval_cost": "1.00",
              "prefix_cost": "167.15",
              "data_read_per_join": "80"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "position"
            ]
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
430628 2601M 0
430629 2601M 0
430635 2601M 0
430650 2601M 0
430654 2601M 0
430657 2601M 0
430658 2601M 0
430660 2601M 0
430664 2601M 0
430673 2601M 0
430678 2601M 0
430680 2601M 0
430684 2601M 0
430689 2601M 0
430691 2601M 0
430695 2601M 0
430703 2601M 0
430737 2601M 0
430746 2601M 0
430751 2601M 0
430756 2601M 0
430758 2601M 0
430768 2601M 0
430769 2601M 0
430789 2601M 0
430795 2601M 0
430807 2601M 0
430808 2601M 0
430812 2601M 0
430813 2601M 0
430817 2601M 0
430818 2601M 0
430819 2601M 0
430820 2601M 0
430822 2601M 0
430825 2601M 0
430834 2601M 0
430838 2601M 0
430842 2601M 0
430843 2601M 0
430859 2601M 0
430860 2601M 0
430868 2601M 0
430875 2601M 0
430890 2601M 0
430892 2601M 0
430901 2601M 0
430902 2601M 0
430904 2601M 0
430906 2601M 0
430909 2601M 0
430921 2601M 0
430922 2601M 0
430923 2601M 0
430925 2601M 0
430928 2601M 0
430950 2601M 0
430959 2601M 0
430962 2601M 0
430988 2601M 0
430989 2601M 0
431008 2601M 0
431013 2601M 0
431035 2601M 0
431041 2601M 0
431043 2601M 0
431044 2601M 0
431049 2601M 0
431053 2601M 0
431063 2601M 0
431064 2601M 0
431066 2601M 0
431068 2601M 0
431073 2601M 0
431080 2601M 0
431082 2601M 0
431083 2601M 0
431085 2601M 0
431103 2601M 0
431109 2601M 0
431110 2601M 0
431114 2601M 0
431118 2601M 0
431120 2601M 0
431126 2601M 0
431127 2601M 0
431144 2601M 0
431148 2601M 0
431156 2601M 0
431159 2601M 0
431161 2601M 0
431163 2601M 0
431164 2601M 0
431169 2601M 0
431183 2601M 0
431194 2601M 0
431250 2601M 0
431313 2601M 0
431456 2601M 0
431459 2601M 0