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

Query time 0.00394

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "859.70"
    },
    "nested_loop": [
      {
        "table": {
          "table_name": "b",
          "access_type": "const",
          "possible_keys": [
            "PRIMARY",
            "p_category_id"
          ],
          "key": "PRIMARY",
          "used_key_parts": [
            "category_id"
          ],
          "key_length": "3",
          "ref": [
            "const"
          ],
          "rows_examined_per_scan": 1,
          "rows_produced_per_join": 1,
          "filtered": "100.00",
          "cost_info": {
            "read_cost": "0.00",
            "eval_cost": "0.10",
            "prefix_cost": "0.00",
            "data_read_per_join": "2K"
          },
          "used_columns": [
            "category_id",
            "id_path"
          ]
        }
      },
      {
        "table": {
          "table_name": "a",
          "access_type": "index",
          "key": "id_path",
          "used_key_parts": [
            "id_path"
          ],
          "key_length": "767",
          "rows_examined_per_scan": 7821,
          "rows_produced_per_join": 868,
          "filtered": "11.11",
          "using_index": true,
          "cost_info": {
            "read_cost": "77.60",
            "eval_cost": "86.89",
            "prefix_cost": "859.70",
            "data_read_per_join": "2M"
          },
          "used_columns": [
            "category_id",
            "id_path"
          ],
          "attached_condition": "(`maniamall_cscart`.`a`.`id_path` like <cache>(concat('297','/%')))"
        }
      }
    ]
  }
}

Result

category_id
1000
1001
1156
21656
21681
2920
31174
1188
1199
1005
1006
1040
1139
1161
1193
1194
1195
1218
6853
7129
8779
1140
1166
1167
1220
7344
1176
1181
2718
6991
1026
1008
1042
1043
30200
7007
1039
10495
1048
2849
1051
1089
1097
1100
1101
6583
1128
1129
2531
1163
1221
1863
1346
1685
1688
1871
2405
2724
2845
1171
1190
41731
8914
1191
1192
1302
1197
1198
1239
1240
1372
1204
1309
1338
1339
1352
1362
1371
1369
1359
1380
1383
1570
15709
15736
16598
16600
16605
16606
16621
16622
16631
17332
19138
19142
19143
19311
21611
19212
19213
21672
17349
17426
19202
19264
19280
17643
27275
27871
17700
19301
19318
2534
2558
3112
3571
7218
2597
26441
2646
2968
36889
37371
37723
39736
39723
39724
4441
4557
4558
4559
4560
5027
5041
10531
10583
10647
10746
5043
5049
5053
5065
5066
5154
5176
5451
5454
5565
6379
6606
6636
6637
6840
6854
862
1033
1037
1113
1133
1215
2555
2856
863
8797
935
1032
1153
1157
1172
2978
5156
2553