I have a delete query that runs when it should not, the WHERE clause condition requires that the query runs once every 600 seconds(ten minutes) since the last database update:
$delete = $wpdb->query( $wpdb->prepare( " DELETE FROM wp_counter_cookies WHERE UNIX_TIMESTAMP(NOW())-UNIX_TIMESTAMP(visit) >= %d ", 600 ) );
If I run the query from my script in quick succession within Wordpress, it still executes regardless of the WHERE clause specification.
When I run this PHP script outside the WordPress environment, it behaves as expected.
What may be wrong in my syntax?