Long waits are a bad idea and should only be used rarely.
And the wait block does not support variables.
You should use a timer instead. That lets the rule exit and run the scheduled code in the background.
It looks like what you really need here is a looping timer. There’s a block library on the marketplace that implements a looping timer which can replace this whole while loop and let you use the state of an Item for the delay without tying up this rule for an indeterminate amount of time.