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 = 7 
WHERE 
  cscart_products_categories.product_id IN (
    1431, 360, 1479, 1478, 414, 1866, 1427, 
    788, 1084, 1407, 1903, 1452, 1453, 538, 
    1864, 1863, 1461, 1199, 1943, 1901, 
    1200, 1212, 1939, 1211, 759, 1415, 1255, 
    1796, 23, 24, 1468, 1466, 1467, 1482, 
    1484, 1568, 1535, 1566, 1567, 1444, 
    1418, 1443, 1054, 1369, 1370, 60, 808, 
    1274, 1030, 1437, 1780, 1031, 807, 1487, 
    806, 1032, 1033, 1470, 370, 1573, 1752, 
    1424, 1423, 1744, 934, 1010, 1434, 1818, 
    153, 1290, 1291, 1292, 1917, 1916, 505, 
    395, 1795, 215, 214, 217, 212, 216, 234, 
    213, 1491, 1496, 1497, 1498, 1480, 1570, 
    1571, 1572, 1626, 1784, 1286, 1287
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00325

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": 97,
      "filtered": 100,
      "index_condition": "cscart_products_categories.product_id in (1431,360,1479,1478,414,1866,1427,788,1084,1407,1903,1452,1453,538,1864,1863,1461,1199,1943,1901,1200,1212,1939,1211,759,1415,1255,1796,23,24,1468,1466,1467,1482,1484,1568,1535,1566,1567,1444,1418,1443,1054,1369,1370,60,808,1274,1030,1437,1780,1031,807,1487,806,1032,1033,1470,370,1573,1752,1424,1423,1744,934,1010,1434,1818,153,1290,1291,1292,1917,1916,505,395,1795,215,214,217,212,216,234,213,1491,1496,1497,1498,1480,1570,1571,1572,1626,1784,1286,1287)"
    },
    "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
23 36M
24 36M
60 20M
153 7M 0
212 22M
213 22M
214 22M
215 22M
216 22M
217 22M
234 22M
360 17M
370 20M
395 22M
414 17M
505 22M
538 17M
759 17M
788 17M
806 22M
807 22M
808 22M
934 20M
1010 20M
1030 22M
1031 22M
1032 8M
1033 22M
1054 43M
1084 17M
1199 8M
1200 8M
1211 8M
1212 8M
1255 36M
1274 22M
1286 43M
1287 43M
1290 43M
1291 43M
1292 43M
1369 43M
1370 43M
1407 7M 0
1415 7M 0
1418 7M 0
1423 7M 0
1424 7M 0
1427 7M 0
1431 7M 0
1434 7M 0
1437 22M
1443 7M 0
1444 7M 0
1452 7M 0
1453 7M 0
1461 20M
1466 36M
1467 36M
1468 36M
1470 8M
1478 17M
1479 17M
1480 36M
1482 36M
1484 36M
1487 22M
1491 8M
1496 8M
1497 8M
1498 8M
1535 8M
1566 8M
1567 8M
1568 8M
1570 8M
1571 8M
1572 8M
1573 8M
1626 7M 0
1744 20M
1752 20M
1780 22M
1784 43M
1795 22M
1796 36M
1818 7M 0
1863 8M
1864 8M
1866 17M
1901 8M
1903 17M
1916 8M
1917 8M
1939 8M
1943 8M