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 
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') 
WHERE 
  cscart_products_categories.product_id IN (
    66018, 66017, 66016, 66015, 66014, 66013, 
    66012, 66011, 66010, 66009, 66008, 
    66007, 66006, 66005, 66004, 66003, 
    66002, 66001, 66000, 65999, 65998, 
    65997, 65996, 65995, 65994
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00043

Explain
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE cscart_products_categories range PRIMARY,pt pt 3 25 Using where; Using index
1 SIMPLE cscart_categories eq_ref PRIMARY,c_status,p_category_id PRIMARY 3 toolboxdigitalshop_dev.cscart_products_categories.category_id 1 Using where

Result

product_id category_ids
65994 3M
65995 22M
65996 22M
65997 22M
65998 22M
65999 22M
66000 22M
66001 22M
66002 22M
66003 22M
66004 22M
66005 22M
66006 22M
66007 22M
66008 22M
66009 22M
66010 22M
66011 22M
66012 22M
66013 22M
66014 22M
66015 22M
66016 22M
66017 22M
66018 22M