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 = 16 
WHERE 
  cscart_products_categories.product_id IN (
    532, 623, 509, 897, 361, 512, 746, 740, 
    984, 707, 317, 745, 529, 834, 380, 1278, 
    436, 586, 596, 1075, 450, 743, 741, 449, 
    747, 1053, 415, 45, 1074, 1240, 431, 
    1244, 1050, 1052, 1089, 939, 889, 1107, 
    620, 379, 903, 316, 594, 533, 812, 430, 
    451, 614
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00193

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 (532,623,509,897,361,512,746,740,984,707,317,745,529,834,380,1278,436,586,596,1075,450,743,741,449,747,1053,415,45,1074,1240,431,1244,1050,1052,1089,939,889,1107,620,379,903,316,594,533,812,430,451,614)"
    },
    "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
45 16M 0
316 16M 0
317 16M 0
361 16M 0
379 16M 0
380 16M 0
415 16M 0
430 16M 0
431 16M 0
436 16M 0
449 16M 0
450 16M 0
451 16M 0
509 16M 0
512 16M 0
529 16M 0
532 16M 0
533 16M 0
586 16M 0
594 16M 0
596 16M 0
614 16M 0
620 16M 0
623 16M 0
707 16M 0
740 16M 0
741 16M 0
743 16M 0
745 16M 0
746 16M 0
747 16M 0
812 16M 0
834 16M 0
889 16M 0
897 16M 0
903 16M 0
939 16M 0
984 16M 0
1050 16M 0
1052 16M 0
1053 16M 0
1074 16M 0
1075 16M 0
1089 16M 0
1107 16M 0
1240 16M 0
1244 16M 0
1278 16M 0