SELECT 
  c.id_path, 
  p.link_type 
FROM 
  cscart_categories as c 
  LEFT JOIN cscart_products_categories as p ON p.category_id = c.category_id 
WHERE 
  p.product_id = 51 
ORDER BY 
  p.category_position DESC, 
  p.category_id DESC

Query time 0.00030

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "2.40"
    },
    "ordering_operation": {
      "using_filesort": true,
      "nested_loop": [
        {
          "table": {
            "table_name": "p",
            "access_type": "ref",
            "possible_keys": [
              "PRIMARY",
              "pt"
            ],
            "key": "pt",
            "used_key_parts": [
              "product_id"
            ],
            "key_length": "3",
            "ref": [
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 1,
            "filtered": "100.00",
            "index_condition": "(`danishecarter_21_apr`.`p`.`product_id` <=> 51)",
            "cost_info": {
              "read_cost": "1.00",
              "eval_cost": "0.20",
              "prefix_cost": "1.20",
              "data_read_per_join": "16"
            },
            "used_columns": [
              "product_id",
              "category_id",
              "link_type",
              "category_position"
            ],
            "attached_condition": "(`danishecarter_21_apr`.`p`.`category_id` is not null)"
          }
        },
        {
          "table": {
            "table_name": "c",
            "access_type": "eq_ref",
            "possible_keys": [
              "PRIMARY",
              "p_category_id"
            ],
            "key": "PRIMARY",
            "used_key_parts": [
              "category_id"
            ],
            "key_length": "3",
            "ref": [
              "danishecarter_21_apr.p.category_id"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 1,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "1.00",
              "eval_cost": "0.20",
              "prefix_cost": "2.40",
              "data_read_per_join": "3K"
            },
            "used_columns": [
              "category_id",
              "id_path"
            ]
          }
        }
      ]
    }
  }
}

Result

id_path link_type
166/175/186 M