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.company_id = 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 (295, 297, 289) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00065

JSON explain

{
  "query_block": {
    "select_id": 1,
    "read_sorted_file": {
      "filesort": {
        "table": {
          "table_name": "cscart_products_categories",
          "access_type": "ALL",
          "possible_keys": ["PRIMARY", "pt"],
          "rows": 13,
          "filtered": 30.769,
          "attached_condition": "(cscart_products_categories.product_id in (295,297,289))"
        }
      }
    },
    "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": ["egkcysbp_cscartn.cscart_products_categories.category_id"],
      "rows": 1,
      "filtered": 100,
      "attached_condition": "((cscart_categories.company_id = 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
289 265M
295 264M,271
297 275M