SELECT 
  category_id 
FROM 
  cscart_categories 
WHERE 
  id_path REGEXP '(^|/)300(/|$)'

Query time 0.00050

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "15.57"
    },
    "table": {
      "table_name": "cscart_categories",
      "access_type": "ALL",
      "rows_examined_per_scan": 141,
      "rows_produced_per_join": 141,
      "filtered": "100.00",
      "cost_info": {
        "read_cost": "1.47",
        "eval_cost": "14.10",
        "prefix_cost": "15.57",
        "data_read_per_join": "572K"
      },
      "used_columns": [
        "category_id",
        "id_path"
      ],
      "attached_condition": "regexp_like(`CS_Cart_Dev`.`cscart_categories`.`id_path`,'(^|/)300(/|$)')"
    }
  }
}

Result

category_id
300
398
397
396
395
394
393
392
330
331
337
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
375
376
401
402
403
404