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