Also, this can probably also be done using wwsh, but I have no experience with that.
Here is a bash command using variables defined in the shell:
echo "update ${coursename}_problem_user set problem_seed=$seed where user_id='$userid' and set_id='$setid' and problem_id=$problemid" |mysql webwork
To use this, set $coursename, $seed, $userid, $setid and $problemid in the shell (or your script), then run the command.
In order to not have to enter a mysql password each time the command is run, you should create a .my.cnf file in the home directory of the user running the script with the following contents:
[client]
user=webworkWrite
password=[your_webworkWrite_password]
Let me know if any of this isn't clear.