Yes, this should be fine. It wont work like resource costs, the ep will be subtracted when the command begins, if there isn't enough the command will be cancelled.
That way, using your example, you could queue more produce X commands than your current ep would allow, and as long as by the time they are started you have sufficient ep, all will be well.