The tmux server does not interpret has_credentials --hours=4 in your #{?has_credentials --hours=4,… as something it should run.
To run some shell code, you need #(). You have used this syntax in Creds: #(credentials_remaining).
Then keep in mind that #{?#(shell code here),first,second} runs shell code here in a shell, gets the output, strips all trailing newlines and gets the last line (if any). If after this the result is an empty string or 0 then the whole snippet will evaluate to what first evaluates to. If the result is anything else (including the kitchen sink, foo, whatever and 1, but also 00, 0, 0 , and such) then the whole snippet will evaluate to what second evaluates to.
This means that if has_credentials --hours=4 gives the answer in some way other than by outputting 0-or-nothing vs anything-else then you need to "translate" it to e.g. 0/1 printed to stdout. In particular, if it reports success by its exit status then the "translation" can be easily done with if.
In the following example we "translate" the exit status of test -e ~/foo which tests if ~/foo exists in the directory tree:
set-option -g status-style '#{?#(if test -e ~/foo; then echo 1; else echo 0; fi),fg=white#,bg=red,fg=red#,bg=white}'Test the solution by alternately creating the file (touch ~/foo) and removing it (rm ~/foo). Note it may take several seconds until the tmux server re-runs the command and the style changes, so be patient.
Also note we needed to escape some , characters as #,. In the example first is fg=white#,bg=red and it evaluates to fg=white,bg=red when appropriate; second is fg=red#,bg=white and it evaluates to fg=red,bg=white when appropriate.