Hi @emilolsson
Your second comment contains the code I would use (if statement), however, I would also use the loop you have developed in your 3rd comment.
It should work.
Perhaps you tested the code when you had a value in the options table? This would cause the if statement to do it’s job and fail the update.
Does that help?
Can you debug the function? ie: print_r and die? This will show you where it gets up to / what the issue is – if any