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 (
    11252, 12823, 10313, 9789, 8328, 12819, 
    7680, 10017, 6903, 9492, 9786, 8332, 
    6902, 9837, 10452, 8121, 9788, 6901, 
    12825, 7080, 6893, 6894, 6895, 6896
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00073

JSON explain

{
  "query_block": {
    "select_id": 1,
    "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"],
          "rows": 24,
          "filtered": 100,
          "index_condition": "cscart_products_categories.product_id in (11252,12823,10313,9789,8328,12819,7680,10017,6903,9492,9786,8332,6902,9837,10452,8121,9788,6901,12825,7080,6893,6894,6895,6896)"
        }
      },
      {
        "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": ["lillyshop_lillyshop.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')"
        }
      }
    ]
  }
}

Result

product_id category_ids
6893 483M
6894 483M
6895 483M
6896 483M
6901 482M
6902 482M
6903 482M
7080 483M
7680 482M
8121 482M
8328 482M
8332 482M
9492 482M
9786 482M
9788 482M
9789 482M
9837 482M
10017 482M
10313 482M
10452 482M
11252 756M
12819 482M
12823 756M
12825 482M