diff --git a/tokenauth.module b/tokenauth.module
index d8c45ce..33004d7 100644
--- a/tokenauth.module
+++ b/tokenauth.module
@@ -183,9 +183,10 @@ function tokenauth_user_insert(&$edit, &$account, $category = NULL) {
 /**
  * Implements hook_user_delete().
  */
-function tokenauth_user_delete(&$edit, &$account, $category = NULL) {
-  $sql = 'DELETE FROM {tokenauth_tokens} WHERE uid = %d';
-  db_query($sql, $account->uid);
+function tokenauth_user_delete($account) {
+	db_delete('tokenauth_tokens')
+    	->condition('uid', $account->uid)
+    	->execute();
 }
 
 /**
