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 (
    982, 981, 983, 828, 421, 647, 315, 624, 
    937, 1131, 671, 670, 42, 43, 1051, 936, 
    935, 599, 900, 44, 404, 835, 836, 1263, 
    322, 311, 312, 744, 742, 837, 537, 839, 
    621, 1048, 1049, 1014, 575, 1034, 1243, 
    1073, 1295, 497, 704, 700, 702, 705, 
    709, 698, 1273, 1134, 607, 1092, 584, 
    1132, 446, 492, 461, 399, 649, 1129, 
    930, 931, 977, 929, 1020, 928, 749, 40, 
    416, 405, 427, 444, 827, 826, 595, 485, 
    486, 838, 549, 660, 546, 1260, 978, 979, 
    401, 400, 457, 462, 516, 564, 321, 989, 
    987, 988, 748, 502
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00301

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": 98,
      "filtered": 100,
      "index_condition": "cscart_products_categories.product_id in (982,981,983,828,421,647,315,624,937,1131,671,670,42,43,1051,936,935,599,900,44,404,835,836,1263,322,311,312,744,742,837,537,839,621,1048,1049,1014,575,1034,1243,1073,1295,497,704,700,702,705,709,698,1273,1134,607,1092,584,1132,446,492,461,399,649,1129,930,931,977,929,1020,928,749,40,416,405,427,444,827,826,595,485,486,838,549,660,546,1260,978,979,401,400,457,462,516,564,321,989,987,988,748,502)"
    },
    "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
40 16M 0
42 16M 0
43 16M 0
44 16M 0
311 16M 0
312 16M 0
315 16M 0
321 16M 0
322 16M 0
399 16M 0
400 16M 0
401 16M 0
404 16M 0
405 16M 0
416 16M 0
421 16M 0
427 16M 0
444 16M 0
446 16M 0
457 16M 0
461 16M 0
462 16M 0
485 16M 0
486 16M 0
492 16M 0
497 16M 0
502 16M 0
516 16M 0
537 16M 0
546 16M 0
549 16M 0
564 16M 0
575 16M 0
584 16M 0
595 16M 0
599 16M 0
607 16M 0
621 16M 0
624 16M 0
647 16M 0
649 16M 0
660 16M 0
670 16M 0
671 16M 0
698 16M 0
700 16M 0
702 16M 0
704 16M 0
705 16M 0
709 16M 0
742 16M 0
744 16M 0
748 16M 0
749 16M 0
826 16M 0
827 16M 0
828 16M 0
835 16M 0
836 16M 0
837 16M 0
838 16M 0
839 16M 0
900 16M 0
928 16M 0
929 16M 0
930 16M 0
931 16M 0
935 16M 0
936 16M 0
937 16M 0
977 16M 0
978 16M 0
979 16M 0
981 16M 0
982 16M 0
983 16M 0
987 16M 0
988 16M 0
989 16M 0
1014 16M 0
1020 16M 0
1034 16M 0
1048 16M 0
1049 16M 0
1051 16M 0
1073 16M 0
1092 16M 0
1129 16M 0
1131 16M 0
1132 16M 0
1134 16M 0
1243 16M 0
1260 16M 0
1263 16M 0
1273 16M 0
1295 16M 0