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