UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VP1Zz2O/6RLjJ/oE0fDozmS86pmLhUuOLUPW2lQc+sk='
WHERE
key_id = 'a23bf6937fb584eaf888998a1dd95e03776d6a24516ccd1fa2df5d78ea263c22'
AND (
token = 'VP1Zz2O/6RLjJ/oE0fDozmS86pmLhUuOLUPW2lQc+sk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)