UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XS9kQkdErz8tF+OyOK0v8ImDiSxBYSVlu2R+RRl4YGI='
WHERE
key_id = '65af5c60eb6b4d0c7d9ad62adc2e92da0317b18153fcea3dc77449338b24d60b'
AND (
token = 'XS9kQkdErz8tF+OyOK0v8ImDiSxBYSVlu2R+RRl4YGI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)