Perversion over lax type conversion in mysql.
First, this expression is calculated for each row of the result, then sorting is performed on this digit. The sorting is affected by all the fields mentioned in the expression, sorted by the result of the expression.
( currency = 'rub' )
If the currency field is equal to the string 'rub', then true is obtained, otherwise false. Then try to multiply the value of the cost of this line. Multiplication is a numeric operation, so a boolean result is reduced to a number. If true - then to 1, false - to 0. And multiplication is performed. If the currency is matched with 'rub', then the result will be the value of the cost field, otherwise - 0.
Similarly for other terms:
((currency = 'usd') * cost * 1 / 0.033)
If the currency was usd, then 1 is multiplied by cost and multiplied by 1 and divided by 0.033. If the currency is not usd, then it will be 0, because multiplying zero by anything will be 0.
As a result, the currency is checked in each term. If the currency does not match - then this term becomes 0.
More explicitly, this can be written as a case:
case currency when 'rub' then cost when 'usd' then cost / 0.033 when 'eur' then cost / 0.025 end