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 (
    1336, 1837, 1820, 1304, 1738, 1893, 1895, 
    1894, 1641, 1500, 1317, 1670, 1658, 
    1558, 1644, 1262, 1552, 1398, 1595, 
    1576, 1870, 1691, 1776, 1785, 1633, 
    1563, 1564, 1667, 1786, 1945, 1910, 
    1787, 1308, 1642, 1772, 1736, 1277, 
    1672, 1325, 1665, 1778, 1775, 1671, 
    1649, 1909, 1948, 1612, 1267
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00183

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 (1336,1837,1820,1304,1738,1893,1895,1894,1641,1500,1317,1670,1658,1558,1644,1262,1552,1398,1595,1576,1870,1691,1776,1785,1633,1563,1564,1667,1786,1945,1910,1787,1308,1642,1772,1736,1277,1672,1325,1665,1778,1775,1671,1649,1909,1948,1612,1267)"
    },
    "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
1262 13M 0
1267 13M 0
1277 13M 0
1304 13M 0
1308 13M 0
1317 13M 0
1325 13M 0
1336 13M 0
1398 13M 0
1500 13M 0
1552 13M 0
1558 13M 0
1563 13M 0
1564 13M 0
1576 13M 0
1595 13M 0
1612 13M 0
1633 13M 0
1641 13M 0
1642 13M 0
1644 13M 0
1649 13M 0
1658 13M 0
1665 13M 0
1667 13M 0
1670 13M 0
1671 13M 0
1672 13M 0
1691 13M 0
1736 13M 0
1738 13M 0
1772 13M 0
1775 13M 0
1776 13M 0
1778 13M 0
1785 13M 0
1786 13M 0
1787 13M 0
1820 13M 0
1837 13M 0
1870 13M 0
1893 13M 0
1894 13M 0
1895 13M 0
1909 13M 0
1910 13M 0
1945 13M 0
1948 13M 0