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 (
    430926, 430940, 431264, 431301, 431339, 
    431426, 435509, 430782, 430879, 431020, 
    431022, 431193, 430816, 431275, 339726, 
    430661, 430794, 431171, 430641, 430788, 
    430811, 430839, 431334, 339825, 430675, 
    430742, 430863, 430968, 431055, 430953, 
    431428, 430805, 430894, 431005, 431098, 
    431244, 339855, 339718, 430688, 430755, 
    430800, 430826, 430917, 430952, 430979, 
    431006, 431262, 430713, 430874, 431028, 
    431336, 431504, 430778, 430827, 430852, 
    430855, 430856, 430931, 430991, 431000, 
    431027, 431101, 431451, 431177, 431184, 
    431358, 430864, 431469, 430694, 430780, 
    431234, 431368, 339675, 430671, 430918, 
    430995, 431342, 430897, 431420, 430702, 
    430706, 430840, 430878, 430888, 430977, 
    430990, 431357, 339597, 430666, 431010, 
    431344, 430667, 430871, 431297, 431381, 
    339782, 381709, 430692, 430997, 431025
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00267

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 (430926,430940,431264,431301,431339,431426,435509,430782,430879,431020,431022,431193,430816,431275,339726,430661,430794,431171,430641,430788,430811,430839,431334,339825,430675,430742,430863,430968,431055,430953,431428,430805,430894,431005,431098,431244,339855,339718,430688,430755,430800,430826,430917,430952,430979,431006,431262,430713,430874,431028,431336,431504,430778,430827,430852,430855,430856,430931,430991,431000,431027,431101,431451,431177,431184,431358,430864,431469,430694,430780,431234,431368,339675,430671,430918,430995,431342,430897,431420,430702,430706,430840,430878,430888,430977,430990,431357,339597,430666,431010,431344,430667,430871,431297,431381,339782,381709,430692,430997,431025))"
          }
        },
        {
          "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
339597 395M
339675 395M
339718 395M
339726 395M
339782 395M
339825 395M
339855 395M
381709 2578M
430641 2601M
430661 2601M
430666 2601M
430667 2601M
430671 2601M
430675 2601M
430688 2601M
430692 2601M
430694 2601M
430702 2601M
430706 2601M
430713 2601M
430742 2601M
430755 2601M
430778 2601M
430780 2601M
430782 2601M
430788 2601M
430794 2601M
430800 2601M
430805 2601M
430811 2601M
430816 2601M
430826 2601M
430827 2601M
430839 2601M
430840 2601M
430852 2601M
430855 2601M
430856 2601M
430863 2601M
430864 2601M
430871 2601M
430874 2601M
430878 2601M
430879 2601M
430888 2601M
430894 2601M
430897 2601M
430917 2601M
430918 2601M
430926 2601M
430931 2601M
430940 2601M
430952 2601M
430953 2601M
430968 2601M
430977 2601M
430979 2601M
430990 2601M
430991 2601M
430995 2601M
430997 2601M
431000 2601M
431005 2601M
431006 2601M
431010 2601M
431020 2601M
431022 2601M
431025 2601M
431027 2601M
431028 2601M
431055 2601M
431098 2601M
431101 2601M
431171 2601M
431177 2601M
431184 2601M
431193 2601M
431234 2601M
431244 2601M
431262 2601M
431264 2601M
431275 2601M
431297 2601M
431301 2601M
431334 2601M
431336 2601M
431339 2601M
431342 2601M
431344 2601M
431357 2601M
431358 2601M
431368 2601M
431381 2601M
431420 2601M
431426 2601M
431428 2601M
431451 2601M
431469 2601M
431504 2601M
435509 2601M