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 (
    430695, 430988, 430644, 431073, 431083, 
    431313, 430628, 430730, 431043, 431135, 
    430842, 430844, 431063, 431089, 431167, 
    431183, 431459, 339831, 430829, 430651, 
    430662, 430880, 430884, 431066, 430869, 
    430898, 430899, 430928, 339762, 430769, 
    430962, 431142, 339781, 430684, 431035, 
    430653, 430712, 430847, 430891, 431140, 
    430631, 430893, 430626, 431185, 381713, 
    431031, 431093, 430881, 430896, 430909, 
    431123, 339733, 339691, 430806, 430883, 
    431197, 430633, 430797, 430900, 430980, 
    431250, 339600, 430873, 431088, 431226, 
    430837, 430787, 430876, 430930, 431023, 
    430645, 430685, 430758, 430913, 431064, 
    339804, 430676, 430768, 430772, 431119, 
    431121, 339488, 430760, 430841, 430981, 
    431008, 431078, 431131, 431198, 339594, 
    430796, 430802, 430846, 431032, 431113, 
    431159, 431178, 431356, 430698, 430703
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00244

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 (430695,430988,430644,431073,431083,431313,430628,430730,431043,431135,430842,430844,431063,431089,431167,431183,431459,339831,430829,430651,430662,430880,430884,431066,430869,430898,430899,430928,339762,430769,430962,431142,339781,430684,431035,430653,430712,430847,430891,431140,430631,430893,430626,431185,381713,431031,431093,430881,430896,430909,431123,339733,339691,430806,430883,431197,430633,430797,430900,430980,431250,339600,430873,431088,431226,430837,430787,430876,430930,431023,430645,430685,430758,430913,431064,339804,430676,430768,430772,431119,431121,339488,430760,430841,430981,431008,431078,431131,431198,339594,430796,430802,430846,431032,431113,431159,431178,431356,430698,430703))"
          }
        },
        {
          "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
339594 395M
339600 395M
339691 395M
339733 395M
339762 395M
339781 395M
339804 9943M
339831 395M
381713 2578M
430626 2601M
430628 2601M
430631 2601M
430633 2601M
430644 2601M
430645 2601M
430651 2601M
430653 2601M
430662 2601M
430676 2601M
430684 2601M
430685 2601M
430695 2601M
430698 2601M
430703 2601M
430712 2601M
430730 2601M
430758 2601M
430760 2601M
430768 2601M
430769 2601M
430772 2601M
430787 2601M
430796 2601M
430797 2601M
430802 2601M
430806 2601M
430829 2601M
430837 2601M
430841 2601M
430842 2601M
430844 2601M
430846 2601M
430847 2601M
430869 2601M
430873 2601M
430876 2601M
430880 2601M
430881 2601M
430883 2601M
430884 2601M
430891 2601M
430893 2601M
430896 2601M
430898 2601M
430899 2601M
430900 2601M
430909 2601M
430913 2601M
430928 2601M
430930 2601M
430962 2601M
430980 2601M
430981 2601M
430988 2601M
431008 2601M
431023 2601M
431031 2601M
431032 2601M
431035 2601M
431043 2601M
431063 2601M
431064 2601M
431066 2601M
431073 2601M
431078 2601M
431083 2601M
431088 2601M
431089 2601M
431093 2601M
431113 2601M
431119 2601M
431121 2601M
431123 2601M
431131 2601M
431135 2601M
431140 2601M
431142 2601M
431159 2601M
431167 2601M
431178 2601M
431183 2601M
431185 2601M
431197 2601M
431198 2601M
431226 2601M
431250 2601M
431313 2601M
431356 2601M
431459 2601M