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