UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '9ZwD1hYFvCdFHFzMnKC/lE/6mdH2WlcYTwFn1VFzxeo='
WHERE
key_id = '699912e07e483d06b18c4054485610c129c6fb70173e52e2ea327451d65e7501'
AND (
token = '9ZwD1hYFvCdFHFzMnKC/lE/6mdH2WlcYTwFn1VFzxeo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)