UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '6BN8VaK+vStg4fa6RWoQnJg3NWqVSMZDNqZmzGLhuBU='
WHERE
key_id = 'df4936d09977fa23d28b46f74445798031f71cf2c5b6686d0be2df6c2b58ea8d'
AND (
token = '6BN8VaK+vStg4fa6RWoQnJg3NWqVSMZDNqZmzGLhuBU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)