UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1q4D44p25j49YziRLHIhu7zkF8/1eHxutta/tNnwgjU='
WHERE
key_id = '74c324ac6264c2672fedfd4cfeb38cbb3024aea9036da55afc1259469bb73ea3'
AND (
token = '1q4D44p25j49YziRLHIhu7zkF8/1eHxutta/tNnwgjU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)