SELECT 
  id_path 
FROM 
  cscart_categories 
WHERE 
  category_id IN (
    297, 302, 303, 311, 312, 313, 314, 315, 
    318, 319, 320
  )

Query time 0.00043

JSON explain

{
  "query_block": {
    "select_id": 1,
    "nested_loop": [
      {
        "table": {
          "table_name": "cscart_categories",
          "access_type": "ALL",
          "possible_keys": ["PRIMARY", "p_category_id"],
          "rows": 12,
          "filtered": 91.66666412,
          "attached_condition": "cscart_categories.category_id in (297,302,303,311,312,313,314,315,318,319,320)"
        }
      }
    ]
  }
}

Result

id_path
297
318
302
303
319
320
315
314
302/311
302/312
302/313