SELECT 
  id_path 
FROM 
  cscart_categories 
WHERE 
  category_id IN (
    338, 339, 345, 349, 350, 359, 361, 362, 
    369, 370, 374, 378, 379, 381, 390, 391, 
    395
  )

Query time 0.00062

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": 17,
      "filtered": "14.78",
      "cost_info": {
        "read_cost": "24.62",
        "eval_cost": "3.40",
        "prefix_cost": "28.02",
        "data_read_per_join": "45K"
      },
      "used_columns": [
        "category_id",
        "id_path"
      ],
      "attached_condition": "(`eshopuga_upgr_4122`.`cscart_categories`.`category_id` in (338,339,345,349,350,359,361,362,369,370,374,378,379,381,390,391,395))"
    }
  }
}

Result

id_path
329/361
329/362
328/335/350
328/336/345
328/336/339
328/336/338
328/335/349
329/359
330/378
330/374
330/370
330/369
331/379
331/381
332/390
332/391
332/395