SELECT 
  a.category_id 
FROM 
  cscart_categories as a 
  LEFT JOIN cscart_categories as b ON b.category_id IN (18319) 
WHERE 
  a.id_path LIKE CONCAT(b.id_path, '/%')

Query time 0.00006

JSON explain

{
  "query_block": {
    "select_id": 1,
    "nested_loop": [
      {
        "table": {
          "table_name": "b",
          "access_type": "const",
          "possible_keys": ["PRIMARY", "p_category_id"],
          "key": "PRIMARY",
          "key_length": "3",
          "used_key_parts": ["category_id"],
          "ref": ["const"],
          "rows": 1,
          "filtered": 100
        }
      },
      {
        "table": {
          "table_name": "a",
          "access_type": "ALL",
          "rows": 2670,
          "filtered": 100,
          "attached_condition": "a.id_path like <cache>(concat('18318/18319','/%'))"
        }
      }
    ]
  }
}

Result

category_id
18334
18348
18351
18361
18381
18320
18335
18349
18352
18362
18382
18323
18336
18353
18363
18383
18333
18337
18354
18364
18384
18338
18347
18355
18365
18385
18339
18350
18359
18366
18386
18340
18360
18387
18341
18367
18342
18368
18389
18343
18369
18390
18344
18370
18345
18371
18346
18372
18379
18380
18394
18397
18398
18404
18405
18406
18407
18408