UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'GpWHUZ+v47bep5CVYkccyAiwLJvwd+D1dnCyBlQpcy8='
WHERE
key_id = '716a0d31c19daf61ddfbae24c3b806e49bae37eb6d4059d693453096a92b29cf'
AND (
token = 'GpWHUZ+v47bep5CVYkccyAiwLJvwd+D1dnCyBlQpcy8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)