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