SELECT HP.id, HP.price, HP.currency, HP.recycling_price_rub, HP.discount_percent, HP.price_difference, ((HP.price * COALESCE(CUR.price, 1)) * (1 - HP.discount_percent / 100) + HP.recycling_price_rub) AS total_price, HP.created_at, HP.creator_id, CUR.price AS rate
            FROM `cscart_product_prices_history` AS `HP` 
                 LEFT JOIN `cscart_currencies` AS `CUR` ON `HP`.`currency` = `CUR`.`currency_code`
                 WHERE `HP`.`product_id` = 22179 
                 ORDER BY `HP`.`created_at` ASC

Query is invalid

JSON explain

{
  "query_block": {
    "select_id": 1,
    "cost_info": {
      "query_cost": "0.93"
    },
    "ordering_operation": {
      "using_filesort": true,
      "nested_loop": [
        {
          "table": {
            "table_name": "HP",
            "access_type": "ref",
            "possible_keys": [
              "idx_hp_product_id"
            ],
            "key": "idx_hp_product_id",
            "used_key_parts": [
              "product_id"
            ],
            "key_length": "3",
            "ref": [
              "const"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 1,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "0.48",
              "eval_cost": "0.10",
              "prefix_cost": "0.58",
              "data_read_per_join": "240"
            },
            "used_columns": [
              "id",
              "product_id",
              "price",
              "currency",
              "recycling_price_rub",
              "discount_percent",
              "price_difference",
              "creator_id",
              "created_at"
            ]
          }
        },
        {
          "table": {
            "table_name": "CUR",
            "access_type": "eq_ref",
            "possible_keys": [
              "currency_code"
            ],
            "key": "currency_code",
            "used_key_parts": [
              "currency_code"
            ],
            "key_length": "12",
            "ref": [
              "dev2.HP.currency"
            ],
            "rows_examined_per_scan": 1,
            "rows_produced_per_join": 1,
            "filtered": "100.00",
            "cost_info": {
              "read_cost": "0.25",
              "eval_cost": "0.10",
              "prefix_cost": "0.93",
              "data_read_per_join": "96"
            },
            "used_columns": [
              "currency_id",
              "currency_code",
              "price"
            ]
          }
        }
      ]
    }
  }
}