UPDATE catalog_product_entity_decimal cd
JOIN (SELECT cp.store_id, cp.entity_id, cp.value, cp.value * cr.rate as value_rate
FROM catalog_product_entity_varchar cp
JOIN directory_currency_rate cr ON cr.currency_from = 'RUB' AND cr.currency_to = 'EUR'
WHERE cp.attribute_id = 138) j ON cd.store_id = j.store_id AND cd.entity_id = j.entity_id
SET cd.value = j.value_rate;