UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7IIG56ih0NAG9Oa2mcVSnpIrFk21Bw1v9svqDB+BIEk='
WHERE
key_id = 'b1c59d23b3830e1e6ddefbe5bb94e688616f2a39d5c34d9fdac9b56c3542f911'
AND (
token = '7IIG56ih0NAG9Oa2mcVSnpIrFk21Bw1v9svqDB+BIEk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)