How can I get a mysql query command to execute after 30 seconds of visiting a php site?
you could put your mysql query into another page and then with your current one, set the header: refresh to that page. Would that be suitable for what you are looking for?
<?php
header("refresh:30;url=\"http://www.yourdomain.com/mysqlquery.php");
?>
Put this at the very top of your page before any html is sent to the browser.
You can make AJAX request for a php script which executes your mysql query, use timer in js.