UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7g6REIZu3oD2bu6GdjAxYW0edhaqrh7V6RrA9jhsEk8='
WHERE
key_id = 'f8b5fa514efb8ebcc792cda17db33352749087e4f44a9b10f0f2b6c14e4040c0'
AND (
token = '7g6REIZu3oD2bu6GdjAxYW0edhaqrh7V6RrA9jhsEk8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)