Help with advanced query with AND and OR in it

I’m trying to form an advanced query which returns either (a) tasks marked DOING or (b) tasks scheduled before tomorrow marked TODO.

My best guess is:

#+BEGIN_QUERY
{:title "🔨 ACTIVE"
   :query [:find (pull ?b [*])
          :in $ ?tod
          :where
          [?b :block/marker ?marker]
          (or [(contains? #{"DOING"} ?marker)]
                (and [(contains? #{"TODO"} ?marker)]
                         [?b :block/scheduled ?d]
                         [(<= ?d ?tod)]))
          ]
   :inputs [:today]
 :result-transform (fn [result]
                       (sort-by (fn [h]
                                    (get h :block/priority "Z")) result))
 :breadcrumbs-show? true
 :collapsed? false}
#+END_QUERY

However, I get a Block Render Error.

Can anyone shed light on what I’m doing wrong?