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 = 27 
WHERE 
  cscart_products_categories.product_id IN (
    243, 246, 244, 242, 245, 240, 290, 508, 
    295, 286, 259, 260, 249, 716, 719, 211, 
    253, 239, 93, 262, 325, 221, 809, 254, 
    1237, 271, 1009, 264, 725, 250, 266, 
    235, 873, 872, 875, 874, 666, 300, 669, 
    664, 309, 287, 288, 668, 667, 308, 662, 
    663
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00198

JSON explain

{
  "query_block": {
    "select_id": 1,
    "table": {
      "table_name": "cscart_products_categories",
      "access_type": "range",
      "possible_keys": ["PRIMARY", "pt"],
      "key": "pt",
      "key_length": "3",
      "used_key_parts": ["product_id"],
      "rows": 48,
      "filtered": 100,
      "index_condition": "cscart_products_categories.product_id in (243,246,244,242,245,240,290,508,295,286,259,260,249,716,719,211,253,239,93,262,325,221,809,254,1237,271,1009,264,725,250,266,235,873,872,875,874,666,300,669,664,309,287,288,668,667,308,662,663)"
    },
    "table": {
      "table_name": "cscart_categories",
      "access_type": "eq_ref",
      "possible_keys": ["PRIMARY", "c_status", "p_category_id"],
      "key": "PRIMARY",
      "key_length": "3",
      "used_key_parts": ["category_id"],
      "ref": ["bacpvdev_db.cscart_products_categories.category_id"],
      "rows": 1,
      "filtered": 100,
      "attached_condition": "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')"
    },
    "table": {
      "table_name": "product_position_source",
      "access_type": "eq_ref",
      "possible_keys": ["PRIMARY", "pt"],
      "key": "PRIMARY",
      "key_length": "6",
      "used_key_parts": ["category_id", "product_id"],
      "ref": ["const", "bacpvdev_db.cscart_products_categories.product_id"],
      "rows": 1,
      "filtered": 100
    }
  }
}

Result

product_id category_ids position
93 27M 0
211 27M 0
221 27M 0
235 27M 0
239 27M 0
240 27M 0
242 27M 0
243 27M 0
244 27M 0
245 27M 0
246 27M 0
249 27M 0
250 27M 0
253 27M 0
254 27M 0
259 27M 0
260 27M 0
262 27M 0
264 27M 0
266 27M 0
271 27M 0
286 27M 0
287 27M 0
288 27M 0
290 27M 0
295 27M 0
300 27M 0
308 27M 0
309 27M 0
325 27M 0
508 27M 0
662 27M 0
663 27M 0
664 27M 0
666 27M 0
667 27M 0
668 27M 0
669 27M 0
716 27M 0
719 27M 0
725 27M 0
809 27M 0
872 27M 0
873 27M 0
874 27M 0
875 27M 0
1009 27M 0
1237 27M 0