UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r3ahzHabZGdTp0Sf1u3zcTzo7AWnO12+URxv9ESd078='
WHERE
key_id = 'f596e8215980bcf3a158671f63a411652ce00a9686ad58ea843254f9335e3fcb'
AND (
token = 'r3ahzHabZGdTp0Sf1u3zcTzo7AWnO12+URxv9ESd078='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)