SELECT 
  id_path 
FROM 
  cscart_categories 
WHERE 
  category_id IN (
    338, 339, 341, 342, 344, 345, 349, 350, 
    351, 352, 353, 354, 355, 356, 357, 358, 
    369, 370, 371, 372, 373, 374, 375, 376, 
    377, 378
  )

Query time 0.00126

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "28.02"
    },
    "table": {
      "table_name": "cscart_categories",
      "access_type": "ALL",
      "possible_keys": [
        "PRIMARY",
        "p_category_id"
      ],
      "rows_examined_per_scan": 115,
      "rows_produced_per_join": 26,
      "filtered": "22.61",
      "cost_info": {
        "read_cost": "22.82",
        "eval_cost": "5.20",
        "prefix_cost": "28.02",
        "data_read_per_join": "69K"
      },
      "used_columns": [
        "category_id",
        "id_path"
      ],
      "attached_condition": "(`eshopuga_upgr_4122`.`cscart_categories`.`category_id` in (338,339,341,342,344,345,349,350,351,352,353,354,355,356,357,358,369,370,371,372,373,374,375,376,377,378))"
    }
  }
}

Result

id_path
328/335/353
328/335/352
328/335/350
328/335/351
328/336/345
328/336/344
328/336/339
328/336/341
328/336/342
328/336/338
328/335/349
328/335/354
328/335/355
328/335/356
328/335/357
328/335/358
330/378
330/377
330/376
330/375
330/374
330/373
330/372
330/371
330/370
330/369