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 = 27 
WHERE 
  cscart_products_categories.product_id IN (
    176, 196, 175, 189, 187, 195, 186, 185, 
    193, 167, 178, 179, 190, 180, 181, 169, 
    165, 171, 159, 177, 739, 738, 1185, 790, 
    799, 1842, 796, 994, 972, 971, 314, 261, 
    673, 275, 1029, 925, 1027, 276, 331, 
    328, 811, 810, 1039, 1038, 1040, 233, 
    231, 232, 243, 246, 244, 242, 245, 240, 
    290, 508, 295, 286, 259, 260, 249, 716, 
    719, 211, 253, 239, 93, 262, 325, 221, 
    809, 254, 1237, 271, 1009, 264, 725, 
    250, 266, 235, 873, 872, 875, 874, 666, 
    300, 669, 664, 309, 287, 288, 668, 667, 
    308, 662, 663
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00280

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": 96,
      "filtered": 100,
      "index_condition": "cscart_products_categories.product_id in (176,196,175,189,187,195,186,185,193,167,178,179,190,180,181,169,165,171,159,177,739,738,1185,790,799,1842,796,994,972,971,314,261,673,275,1029,925,1027,276,331,328,811,810,1039,1038,1040,233,231,232,243,246,244,242,245,240,290,508,295,286,259,260,249,716,719,211,253,239,93,262,325,221,809,254,1237,271,1009,264,725,250,266,235,873,872,875,874,666,300,669,664,309,287,288,668,667,308,662,663)"
    },
    "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
93 27M 0
159 27M 0
165 27M 0
167 27M 0
169 27M 0
171 27M 0
175 27M 0
176 27M 0
177 27M 0
178 27M 0
179 27M 0
180 27M 0
181 27M 0
185 27M 0
186 27M 0
187 27M 0
189 27M 0
190 27M 0
193 27M 0
195 27M 0
196 27M 0
211 27M 0
221 27M 0
231 27M 0
232 27M 0
233 27M 0
235 27M 0
239 27M 0
240 27M 0
242 27M 0
243 27M 0
244 27M 0
245 27M 0
246 27M 0
249 27M 0
250 27M 0
253 27M 0
254 27M 0
259 27M 0
260 27M 0
261 27M 0
262 27M 0
264 27M 0
266 27M 0
271 27M 0
275 27M 0
276 27M 0
286 27M 0
287 27M 0
288 27M 0
290 27M 0
295 27M 0
300 27M 0
308 27M 0
309 27M 0
314 27M 0
325 27M 0
328 27M 0
331 27M 0
508 27M 0
662 27M 0
663 27M 0
664 27M 0
666 27M 0
667 27M 0
668 27M 0
669 27M 0
673 27M 0
716 27M 0
719 27M 0
725 27M 0
738 27M 0
739 27M 0
790 27M 0
796 27M 0
799 27M 0
809 27M 0
810 27M 0
811 27M 0
872 27M 0
873 27M 0
874 27M 0
875 27M 0
925 27M 0
971 27M 0
972 27M 0
994 27M 0
1009 27M 0
1027 27M 0
1029 27M 0
1038 27M 0
1039 27M 0
1040 27M 0
1185 27M 0
1237 27M 0
1842 27M 0