UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8589buq1UhiBnbXabkIldpYwxMFftKKFtj7c7vWVSUk='
WHERE
key_id = '86f4ff2d66738410c11a9a2f449d08b245fa182c3b02f23511aa14183ddb1a41'
AND (
token = '8589buq1UhiBnbXabkIldpYwxMFftKKFtj7c7vWVSUk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)