Posting it for others that may encounter the same issue, as I solved it.
Recently I had a workflow using dynamic inputs to customize a database query. All worked fine in the Designer, but for unknow reason, when we were running the same workflow from command line, Dynamic Input query updates/replaces did not work properly, and completely randomly. To give an example, we had 'LastName' placeholder that was supposed to be replaced with actual last name, but weren't. There were originally two replaces to be made. I reduced it to one for testing and it sometimes worked. What was crazy, adding a random Message tool after, made it to work, but still only with one replace. Two replaces still were ignored.
The workaround was to prepare query string completely outside of the tool, put just SELECT 1 in the tool and replace this. It works fine. Not sure if it's a known issue, I didn't find any trace of it on the forum or the internet.
I don't know if it mattered in any way, but it was an AnalyticsApp that was fed parameters through xml file, but there was no error. The parameters were read properly.