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 (
    77716, 77715, 77714, 77713, 77712, 77711, 
    77710, 77709, 77708, 77707, 77706, 
    77705, 77704, 77703, 77702, 77701, 
    77700, 77699, 77698, 77697, 77696, 
    77695, 77694, 77693, 77692, 77691, 
    77690, 77689
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00048

Explain
id select_type table type possible_keys key key_len ref rows Extra
1 SIMPLE cscart_products_categories range PRIMARY,pt pt 3 28 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
77689 4M
77690 4M
77691 4M
77692 4M
77693 4M
77694 4M
77695 4M
77696 4M
77697 4M
77698 4M
77699 4M
77700 4M
77701 4M
77702 4M
77703 4M
77704 4M
77705 4M
77706 4M
77707 4M
77708 4M
77709 4M
77710 4M
77711 4M
77712 4M
77713 4M
77714 4M
77715 4M
77716 4M