UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CI5m76qr4j+Spc2ddyXIyWVYRKQWvjP0qyMRCMXFBwg='
WHERE
key_id = 'f491d3b5082c2ed06499472ad41e2fa9e60f055607ed8dd913e550fca532eef5'
AND (
token = 'CI5m76qr4j+Spc2ddyXIyWVYRKQWvjP0qyMRCMXFBwg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)