SELECT 
  id_path 
FROM 
  cscart_categories 
WHERE 
  category_id IN (31, 32, 33)

Query time 0.00032

JSON explain

{
  "query_block": {
    "select_id": 1,
    "table": {
      "table_name": "cscart_categories",
      "access_type": "range",
      "possible_keys": ["PRIMARY", "p_category_id"],
      "key": "PRIMARY",
      "key_length": "3",
      "used_key_parts": ["category_id"],
      "rows": 3,
      "filtered": 100,
      "attached_condition": "cscart_categories.category_id in (31,32,33)"
    }
  }
}

Result

id_path
31
31/32
31/32/33