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 (
    65926, 65925, 65924, 65923, 65922, 65921, 
    65920, 65919, 65918, 65917, 65916, 
    65915, 65914, 65913, 65912, 65911, 
    65910, 65909, 65908, 65907, 65906, 
    65905, 65904, 65903, 65902, 65901, 
    65900, 65899, 65898, 65897
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00047

Explain
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE cscart_products_categories range PRIMARY,pt pt 3 30 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
65897 4M
65898 4M
65899 4M
65900 4M
65901 4M
65902 4M
65903 4M
65904 4M
65905 4M
65906 4M
65907 4M
65908 4M
65909 4M
65910 4M
65911 4M
65912 4M
65913 4M
65914 3M
65915 4M
65916 4M
65917 4M
65918 4M
65919 4M
65920 4M
65921 4M
65922 4M
65923 4M
65924 4M
65925 4M
65926 4M