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 = 267 
WHERE 
  cscart_products_categories.product_id IN (
    1335, 1338, 1233, 1324, 1323, 1081, 1326, 
    1325, 1333, 1082, 1321, 1330, 1331, 
    1329, 1334, 1337, 1339, 1340, 1343, 
    399, 1299, 1810, 1811, 2918, 1341, 1342, 
    1856, 2913, 1815, 1819, 2914, 1859, 
    1858, 1850, 1294, 1298, 1297, 1293, 
    1295, 1814, 1816, 1817, 1818, 1820, 
    1821, 1822, 1823, 1824, 1825, 1826, 
    1827, 1828, 1829, 1830, 1831, 1300, 
    1301, 1302, 1304, 1303, 1812, 1808, 
    1807, 1813, 1836, 1860, 1861, 1837, 
    1851, 1853, 1838, 1839, 1840, 1841, 
    1842, 1843, 1844, 1845, 1846, 1847, 
    1848, 1849, 1855, 2915, 1857, 1862, 
    1835, 1834, 1863, 1809, 1864, 1150, 
    1152, 1149, 1151, 1148
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00110

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost": 0.332018364,
    "nested_loop": [
      {
        "table": {
          "table_name": "cscart_products_categories",
          "access_type": "range",
          "possible_keys": ["PRIMARY", "pt"],
          "key": "pt",
          "key_length": "3",
          "used_key_parts": ["product_id"],
          "loops": 1,
          "rows": 96,
          "cost": 0.0950572,
          "filtered": 100,
          "attached_condition": "cscart_products_categories.product_id in (1335,1338,1233,1324,1323,1081,1326,1325,1333,1082,1321,1330,1331,1329,1334,1337,1339,1340,1343,399,1299,1810,1811,2918,1341,1342,1856,2913,1815,1819,2914,1859,1858,1850,1294,1298,1297,1293,1295,1814,1816,1817,1818,1820,1821,1822,1823,1824,1825,1826,1827,1828,1829,1830,1831,1300,1301,1302,1304,1303,1812,1808,1807,1813,1836,1860,1861,1837,1851,1853,1838,1839,1840,1841,1842,1843,1844,1845,1846,1847,1848,1849,1855,2915,1857,1862,1835,1834,1863,1809,1864,1150,1152,1149,1151,1148)",
          "using_index": true
        }
      },
      {
        "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": ["u985510652_ecartify_dev.cscart_products_categories.category_id"],
          "loops": 96,
          "rows": 1,
          "cost": 0.08668544,
          "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",
            "u985510652_ecartify_dev.cscart_products_categories.product_id"
          ],
          "loops": 96,
          "rows": 1,
          "cost": 0.08832384,
          "filtered": 100
        }
      }
    ]
  }
}

Result

product_id category_ids position
399 267M 0
1081 267M 0
1082 267M 0
1148 267M 0
1149 267M 0
1150 267M 0
1151 267M 0
1152 267M 0
1233 267M 0
1293 267M 0
1294 267M 0
1295 267M 0
1297 267M 0
1298 267M 0
1299 267M 0
1300 267M 0
1301 267M 0
1302 267M 0
1303 267M 0
1304 267M 0
1321 267M 0
1323 267M 0
1324 267M 0
1325 267M 0
1326 267M 0
1329 267M 0
1330 267M 0
1331 267M 0
1333 267M 0
1334 267M 0
1335 267M 0
1337 267M 0
1338 267M 0
1339 267M 0
1340 267M 0
1341 267M 0
1342 267M 0
1343 267M 0
1807 267M 0
1808 267M 0
1809 267M 0
1810 267M 0
1811 267M 0
1812 267M 0
1813 267M 0
1814 267M 0
1815 267M 0
1816 267M 0
1817 267M 0
1818 267M 0
1819 267M 0
1820 267M 0
1821 267M 0
1822 267M 0
1823 267M 0
1824 267M 0
1825 267M 0
1826 267M 0
1827 267M 0
1828 267M 0
1829 267M 0
1830 267M 0
1831 267M 0
1834 267M 0
1835 267M 0
1836 267M 0
1837 267M 0
1838 267M 0
1839 267M 0
1840 267M 0
1841 267M 0
1842 267M 0
1843 267M 0
1844 267M 0
1845 267M 0
1846 267M 0
1847 267M 0
1848 267M 0
1849 267M 0
1850 267M 0
1851 267M 0
1853 267M 0
1855 267M 0
1856 267M 0
1857 267M 0
1858 267M 0
1859 267M 0
1860 267M 0
1861 267M 0
1862 267M 0
1863 267M 0
1864 267M 0
2913 267M 0
2914 267M 0
2915 267M 0
2918 267M 0