Iteratively find and modify a certain element in a set in $\log n$ per iteration
Yes, you can achieve that running time if you use the right data structure.  You might want to look at some other data structures, such as AVL trees, red-black trees, or other similar techniques.  See, e.g., https://en.wikipedia.org/wiki/Search_data_structure, https://en.wikipedia.org/wiki/Self-balancing_binary_search_tree,  or your favorite data structures book.