UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '734+VagSy6Np3NmAMKHL37ASfVPYRguFIQBhqqr9GSY='
WHERE
key_id = 'be58f45b9170dfd3fc5f905220644f30305e595dda84f10ba481b0f429274397'
AND (
token = '734+VagSy6Np3NmAMKHL37ASfVPYRguFIQBhqqr9GSY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)