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