UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QRWYRnggfCnYHk4lm6vYJxSNSzFD693mMqE5P2XpOxA='
WHERE
key_id = '9dc3c0034ef5b3fca5e25a7a31d80ee048f251285bc380f6e0f3bb9d5a46f5b0'
AND (
token = 'QRWYRnggfCnYHk4lm6vYJxSNSzFD693mMqE5P2XpOxA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)