UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XbGdKwxP5cJs2Jl2DCIbCIKaKmR7faDStDGEYOSqeLg='
WHERE
key_id = 'dee79b3385a8de0b4bc3a75c2b15d5277a8b270bac4f4070a9f414de24bc9ba5'
AND (
token = 'XbGdKwxP5cJs2Jl2DCIbCIKaKmR7faDStDGEYOSqeLg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)