UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KiW9HiWaDm5gnGiqlxdaE+iXXG/jHRUPnA2iL9abwZM='
WHERE
key_id = '59b3dcb8102f8659fcf195529eea5ae42b6d71738ad5ace6fc482397931c38d6'
AND (
token = 'KiW9HiWaDm5gnGiqlxdaE+iXXG/jHRUPnA2iL9abwZM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)