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 = 7230 
WHERE 
  cscart_products_categories.product_id IN (
    99963, 99964, 99965, 99966, 99967, 99968, 
    99969, 99970, 99971, 99972, 99973, 
    99974, 99975, 99976, 99977, 99978, 
    99979, 99980, 99981, 99982, 99983, 
    99984, 99985, 99986, 99987, 99988, 
    99989, 99990, 99991, 99992, 99993, 
    99994, 99995, 100003, 100004, 100013, 
    100014, 100015, 100016, 100017, 100018, 
    100019, 100020, 100021, 100022, 100023, 
    100024, 100025, 100026, 100027, 100028, 
    100029, 100030, 100031, 100032, 100033, 
    100034, 100035, 100036, 100037, 100038, 
    100039, 100040, 100041, 100042, 100043, 
    100044, 100045, 100046, 100047, 100048, 
    100049, 100050, 100051, 100052, 100053, 
    100054, 100055, 100056, 100057
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.01914

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "72.29"
    },
    "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": 80,
            "rows_produced_per_join": 80,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "8.29",
              "eval_cost": "8.00",
              "prefix_cost": "16.29",
              "data_read_per_join": "1K"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`nuie_scalesta_net`.`cscart_products_categories`.`product_id` in (99963,99964,99965,99966,99967,99968,99969,99970,99971,99972,99973,99974,99975,99976,99977,99978,99979,99980,99981,99982,99983,99984,99985,99986,99987,99988,99989,99990,99991,99992,99993,99994,99995,100003,100004,100013,100014,100015,100016,100017,100018,100019,100020,100021,100022,100023,100024,100025,100026,100027,100028,100029,100030,100031,100032,100033,100034,100035,100036,100037,100038,100039,100040,100041,100042,100043,100044,100045,100046,100047,100048,100049,100050,100051,100052,100053,100054,100055,100056,100057))"
          }
        },
        {
          "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",
              "nuie_scalesta_net.cscart_products_categories.product_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 80,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "20.00",
              "eval_cost": "8.00",
              "prefix_cost": "44.29",
              "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": [
              "nuie_scalesta_net.cscart_products_categories.category_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 4,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "20.00",
              "eval_cost": "0.40",
              "prefix_cost": "72.29",
              "data_read_per_join": "10K"
            },
            "used_columns": [
              "category_id",
              "usergroup_ids",
              "status",
              "storefront_id"
            ],
            "attached_condition": "((`nuie_scalesta_net`.`cscart_categories`.`storefront_id` in (0,1)) and ((`nuie_scalesta_net`.`cscart_categories`.`usergroup_ids` = '') or (0 <> find_in_set(0,`nuie_scalesta_net`.`cscart_categories`.`usergroup_ids`)) or (0 <> find_in_set(1,`nuie_scalesta_net`.`cscart_categories`.`usergroup_ids`))) and (`nuie_scalesta_net`.`cscart_categories`.`status` in ('A','H')))"
          }
        }
      ]
    }
  }
}

Result

product_id category_ids position
99963 7231M
99964 7234M
99965 7231M
99966 7234M
99967 7231M
99968 7231M
99969 7231M
99970 7231M
99971 7231M
99972 7231M
99973 7231M
99974 7234M
99975 7231M
99976 7234M
99977 7231M
99978 7231M
99979 7231M
99980 7234M
99981 7231M
99982 7231M
99983 7234M
99984 7231M
99985 7234M
99986 7231M
99987 7231M
99988 7234M
99989 7231M
99990 7231M
99991 7234M
99992 7231M
99993 7234M
99994 7231M
99995 7234M
100003 7234M
100004 7234M
100013 7234M
100014 7231M
100015 7234M
100016 7231M
100017 7234M
100018 7231M
100019 7234M
100020 7231M
100021 7234M
100022 7231M
100023 7234M
100024 7231M
100025 7234M
100026 7234M
100027 7234M
100028 7234M
100029 7234M
100030 7234M
100031 7234M
100032 7234M
100033 7234M
100034 7234M
100035 7234M
100036 7234M
100037 7234M
100038 7234M
100039 7234M
100040 7234M
100041 7234M
100042 7234M
100043 7234M
100044 7234M
100045 7234M
100046 7234M
100047 7234M
100048 7234M
100049 7234M
100050 7234M
100051 7234M
100052 7234M
100053 7234M
100054 7234M
100055 7234M
100056 7234M
100057 7234M