How to query scheduled/overdue tasks, that are not done yet?

First I queried all scheduled (or deadline) tasks that are overdue or scheduled in next 30 days:

#+BEGIN_QUERY
{:query [:find (pull ?block [*])
          :in $ ?next
          :where
          (or
            [?block :block/scheduled ?d]
            [?block :block/deadline ?d]
          )
          [(< ?d ?next)]
  ]
  :inputs [:30d-after]
  :collapsed? false}
#+END_QUERY

This works, but I have no way to filter out those, that are already marked as DONE.

What I tried in next step: take all scheduled tasks, which haven’t any marker at all or, if existent, do not contain the DONE marker:

#+BEGIN_QUERY
{:title [:b "SCHEDULED, DEADLINE: Overdue and next 30 days "]
  :query [:find (pull ?block [*])
          :in $ ?next
          :where
          (or
            [?block :block/scheduled ?d]
            [?block :block/deadline ?d]
          )
          (or
            (not [?block :block/marker])
            (and 
              [?block :block/marker ?marker]
              (not [(contains? #{"DONE"} ?marker)])
            )
          )
          [(< ?d ?next)]
  ]
  :inputs [:30d-after]
  :collapsed? false}
#+END_QUERY

, which raises a block render error. Any help on this? Error seems to be with:

          (or
            (not [?block :block/marker])
            (and 
              [?block :block/marker ?marker]
              (not [(contains? #{"DONE"} ?marker)])
            )
          )

Found solution:

(not
  [?b :block/marker ?marker] 
  [(contains? #{"DONE"} ?marker)]
 )