UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'wiT87xLSl7wErbaj3QzdL7QMVmTG8OdZDeUCWO2pUFY='
WHERE
key_id = '1f899090690ba25a0c970055c65f0fb4fa2b89098951fed17b4046a916eaa2a5'
AND (
token = 'wiT87xLSl7wErbaj3QzdL7QMVmTG8OdZDeUCWO2pUFY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)