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