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
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00208

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": 49,
      "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)"
    },
    "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
360 17M
414 17M
538 17M
759 17M
788 17M
808 22M
1054 43M
1084 17M
1199 8M
1200 8M
1211 8M
1212 8M
1255 36M
1274 22M
1369 43M
1370 43M
1407 7M 0
1415 7M 0
1418 7M 0
1427 7M 0
1431 7M 0
1443 7M 0
1444 7M 0
1452 7M 0
1453 7M 0
1461 20M
1466 36M
1467 36M
1468 36M
1478 17M
1479 17M
1482 36M
1484 36M
1535 8M
1566 8M
1567 8M
1568 8M
1796 36M
1863 8M
1864 8M
1866 17M
1901 8M
1903 17M
1939 8M
1943 8M