UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QujLqNjnfxYd6T1grBQljYFqb3Hgp3DOz7rmCfnEj38='
WHERE
key_id = 'a0a9c705afeb0dbc440c3487922bf9ac43c4c049c6be7ab5e920839dba62964e'
AND (
token = 'QujLqNjnfxYd6T1grBQljYFqb3Hgp3DOz7rmCfnEj38='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)