UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7ng6HkAnMeqIG5zhQs+nQHY/X/8cb+q6d33gqIru8D4='
WHERE
key_id = '6c802f1a1dac904a1e92c09e67ba55da6909cb33c142d52e047811e38330d662'
AND (
token = '7ng6HkAnMeqIG5zhQs+nQHY/X/8cb+q6d33gqIru8D4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)