UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'cXVJmYxXRwBwDfUaoAXCi8eMgoY7RsTBxW9ECdNy6Hc='
WHERE
key_id = '4fab4c22375b774213bdd8ed3a870443b2567fa4ca358e1db4ece5efb0facdec'
AND (
token = 'cXVJmYxXRwBwDfUaoAXCi8eMgoY7RsTBxW9ECdNy6Hc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)