UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qbjV9mC9IKrMWweJmmkmI6qX2LNmncCPDjVeKB+vUTo='
WHERE
key_id = 'd04281a640d308f2b733b391ff7eab55234849ea94ec21b98d88f91232756310'
AND (
token = 'qbjV9mC9IKrMWweJmmkmI6qX2LNmncCPDjVeKB+vUTo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)