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 = 13 
WHERE 
  cscart_products_categories.product_id IN (
    1788, 1697, 1657, 1687, 1921, 1238, 1197, 
    1307, 1306, 1940, 1941, 1660, 1751, 
    1677, 1305, 1588, 1662, 1635, 1747, 
    1587, 1771, 1709, 1957, 1707, 1768, 
    1710, 1954, 1953, 1730, 1686, 1593, 
    1594, 1616, 1773, 1701, 1584, 1585, 
    1868, 1579, 1956, 1495, 1739, 1740, 
    1912, 1913, 1650, 56, 1836
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00188

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": 75,
      "filtered": 100,
      "index_condition": "cscart_products_categories.product_id in (1788,1697,1657,1687,1921,1238,1197,1307,1306,1940,1941,1660,1751,1677,1305,1588,1662,1635,1747,1587,1771,1709,1957,1707,1768,1710,1954,1953,1730,1686,1593,1594,1616,1773,1701,1584,1585,1868,1579,1956,1495,1739,1740,1912,1913,1650,56,1836)"
    },
    "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
56 13M 0
1197 13M 0
1238 13M 0
1305 13M 0
1306 13M 0
1307 13M 0
1495 13M 0
1579 13M 0
1584 13M 0
1585 13M 0
1587 13M 0
1588 13M 0
1593 13M 0
1594 13M 0
1616 13M 0
1635 13M 0
1650 13M 0
1657 13M 0
1660 13M 0
1662 13M 0
1677 13M 0
1686 13M 0
1687 13M 0
1697 13M 0
1701 13M 0
1707 13M 0
1709 13M 0
1710 13M 0
1730 13M 0
1739 13M 0
1740 13M 0
1747 13M 0
1751 13M 0
1768 13M 0
1771 13M 0
1773 13M 0
1788 13M 0
1836 13M 0
1868 13M 0
1912 13M 0
1913 13M 0
1921 13M 0
1940 13M 0
1941 13M 0
1953 13M 0
1954 13M 0
1956 13M 0
1957 13M 0