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 (
    82038, 148882, 148883, 148884, 148885, 
    148886, 148887, 148888, 148889, 148890, 
    148891, 148892, 148893, 148894, 148895, 
    148896, 148897, 148898, 148899, 148900, 
    148901, 148902, 148903, 148904, 148905, 
    148906, 148907, 148908, 148909, 148910, 
    148911, 148912, 148913, 148914, 148915, 
    148916, 148917, 148918, 148919, 148920, 
    148921, 148922, 148923, 148924, 148925, 
    148926, 148927, 148928, 148929, 148930, 
    148931
  ) 
GROUP BY 
  cscart_products_categories.product_id

Query time 0.00142

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "82.68"
    },
    "grouping_operation": {
      "using_filesort": false,
      "nested_loop": [
        {
          "table": {
            "table_name": "cscart_products_categories",
            "access_type": "range",
            "possible_keys": [
              "PRIMARY",
              "link_type",
              "pt"
            ],
            "key": "pt",
            "used_key_parts": [
              "product_id"
            ],
            "key_length": "3",
            "rows_examined_per_scan": 51,
            "rows_produced_per_join": 51,
            "filtered": "100.00",
            "using_index": true,
            "cost_info": {
              "read_cost": "11.28",
              "eval_cost": "10.20",
              "prefix_cost": "21.48",
              "data_read_per_join": "816"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type"
            ],
            "attached_condition": "(`webmarco`.`cscart_products_categories`.`product_id` in (82038,148882,148883,148884,148885,148886,148887,148888,148889,148890,148891,148892,148893,148894,148895,148896,148897,148898,148899,148900,148901,148902,148903,148904,148905,148906,148907,148908,148909,148910,148911,148912,148913,148914,148915,148916,148917,148918,148919,148920,148921,148922,148923,148924,148925,148926,148927,148928,148929,148930,148931))"
          }
        },
        {
          "table": {
            "table_name": "cscart_categories",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY",
              "c_status",
              "p_category_id"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id"
            ],
            "key_length": "3",
            "ref": [
              "webmarco.cscart_products_categories.category_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 2,
            "filtered": "5.00",
            "cost_info": {
              "read_cost": "51.00",
              "eval_cost": "0.51",
              "prefix_cost": "82.68",
              "data_read_per_join": "15K"
            },
            "used_columns": [
              "category_id",
              "usergroup_ids",
              "status",
              "storefront_id"
            ],
            "attached_condition": "((`webmarco`.`cscart_categories`.`storefront_id` in (0,1)) and ((`webmarco`.`cscart_categories`.`usergroup_ids` = '') or find_in_set(0,`webmarco`.`cscart_categories`.`usergroup_ids`) or find_in_set(1,`webmarco`.`cscart_categories`.`usergroup_ids`)) and (`webmarco`.`cscart_categories`.`status` in ('A','H')))"
          }
        }
      ]
    }
  }
}

Result

product_id category_ids
82038 2904M
148882 2904M
148883 2904M
148884 2904M
148885 2904M
148886 2904M
148887 2904M
148888 2904M
148889 2904M
148890 2904M
148891 2904M
148892 2904M
148893 2904M
148894 2904M
148895 2904M
148896 2904M
148897 2904M
148898 2904M
148899 2904M
148900 2904M
148901 2904M
148902 2904M
148903 2904M
148904 2904M
148905 2904M
148906 2904M
148907 2904M
148908 2904M
148909 2904M
148910 2904M
148911 2904M
148912 2904M
148913 2904M
148914 2904M
148915 2904M
148916 2904M
148917 2904M
148918 2904M
148919 2904M
148920 2904M
148921 2904M
148922 2904M
148923 2904M
148924 2904M
148925 2904M
148926 2904M
148927 2904M
148928 2904M
148929 2904M
148930 2904M
148931 2904M