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 (
    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.00231

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 (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
153 7M 0
212 22M
213 22M
214 22M
215 22M
216 22M
217 22M
234 22M
370 20M
395 22M
505 22M
806 22M
807 22M
934 20M
1010 20M
1030 22M
1031 22M
1032 8M
1033 22M
1286 43M
1287 43M
1290 43M
1291 43M
1292 43M
1423 7M 0
1424 7M 0
1434 7M 0
1437 22M
1470 8M
1480 36M
1487 22M
1491 8M
1496 8M
1497 8M
1498 8M
1570 8M
1571 8M
1572 8M
1573 8M
1626 7M 0
1744 20M
1752 20M
1780 22M
1784 43M
1795 22M
1818 7M 0
1916 8M
1917 8M