UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aKLs0uKAfdcFxVJfQbKAJzBMd6WypayogBUWTQ2/G3k='
WHERE
key_id = '4b6247f6fec533cce5d356d6c3bb95305764907b1f2ccae3cc09dc2143cfb80e'
AND (
token = 'aKLs0uKAfdcFxVJfQbKAJzBMd6WypayogBUWTQ2/G3k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)