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 (
    430994, 430999, 431345, 430634, 430645, 
    430714, 430862, 430885, 430887, 430992, 
    431338, 430656, 430738, 430761, 430865, 
    431054, 431316, 430626, 430870, 431192, 
    430708, 430797, 430853, 431019, 431326, 
    431365, 430677, 430749, 431061, 430802, 
    430846, 430873, 430881, 431011, 431024, 
    431242, 430960, 430993, 431039, 431322, 
    430836, 430936, 431003, 431052, 431395, 
    431429, 430704, 430707, 430905, 430841, 
    430969, 431020, 431022, 431091, 431248, 
    431264, 430810, 431051, 431315, 431503, 
    430652, 430861, 430940, 430984, 431113, 
    431178, 431193, 431247, 431487, 431006, 
    431200, 431301, 431426, 431439, 435509, 
    430782, 430837, 431074, 431339, 430816, 
    430926, 431252, 430641, 430794, 430968, 
    431275, 430788, 430879, 431171, 431334, 
    430661, 430811, 431098, 431055, 430742, 
    430839, 430675, 430800, 430805, 430855
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00373

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 (430994,430999,431345,430634,430645,430714,430862,430885,430887,430992,431338,430656,430738,430761,430865,431054,431316,430626,430870,431192,430708,430797,430853,431019,431326,431365,430677,430749,431061,430802,430846,430873,430881,431011,431024,431242,430960,430993,431039,431322,430836,430936,431003,431052,431395,431429,430704,430707,430905,430841,430969,431020,431022,431091,431248,431264,430810,431051,431315,431503,430652,430861,430940,430984,431113,431178,431193,431247,431487,431006,431200,431301,431426,431439,435509,430782,430837,431074,431339,430816,430926,431252,430641,430794,430968,431275,430788,430879,431171,431334,430661,430811,431098,431055,430742,430839,430675,430800,430805,430855))"
          }
        },
        {
          "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
430626 2601M 0
430634 2601M 0
430641 2601M 0
430645 2601M 0
430652 2601M 0
430656 2601M 0
430661 2601M 0
430675 2601M 0
430677 2601M 0
430704 2601M 0
430707 2601M 0
430708 2601M 0
430714 2601M 0
430738 2601M 0
430742 2601M 0
430749 2601M 0
430761 2601M 0
430782 2601M 0
430788 2601M 0
430794 2601M 0
430797 2601M 0
430800 2601M 0
430802 2601M 0
430805 2601M 0
430810 2601M 0
430811 2601M 0
430816 2601M 0
430836 2601M 0
430837 2601M 0
430839 2601M 0
430841 2601M 0
430846 2601M 0
430853 2601M 0
430855 2601M 0
430861 2601M 0
430862 2601M 0
430865 2601M 0
430870 2601M 0
430873 2601M 0
430879 2601M 0
430881 2601M 0
430885 2601M 0
430887 2601M 0
430905 2601M 0
430926 2601M 0
430936 2601M 0
430940 2601M 0
430960 2601M 0
430968 2601M 0
430969 2601M 0
430984 2601M 0
430992 2601M 0
430993 2601M 0
430994 2601M 0
430999 2601M 0
431003 2601M 0
431006 2601M 0
431011 2601M 0
431019 2601M 0
431020 2601M 0
431022 2601M 0
431024 2601M 0
431039 2601M 0
431051 2601M 0
431052 2601M 0
431054 2601M 0
431055 2601M 0
431061 2601M 0
431074 2601M 0
431091 2601M 0
431098 2601M 0
431113 2601M 0
431171 2601M 0
431178 2601M 0
431192 2601M 0
431193 2601M 0
431200 2601M 0
431242 2601M 0
431247 2601M 0
431248 2601M 0
431252 2601M 0
431264 2601M 0
431275 2601M 0
431301 2601M 0
431315 2601M 0
431316 2601M 0
431322 2601M 0
431326 2601M 0
431334 2601M 0
431338 2601M 0
431339 2601M 0
431345 2601M 0
431365 2601M 0
431395 2601M 0
431426 2601M 0
431429 2601M 0
431439 2601M 0
431487 2601M 0
431503 2601M 0
435509 2601M 0