I used a plugin that generates userhandles and inserts them. It happened, that users simultaneously signed up and the plugin checked if the userhandle does not exist, which was true for both, then used function qa_db_user_create() to create the new user. Hence, the user handle was assigned twice and even the email was there twice!
INSERT INTO `^users`
(created, loggedin, createip, email, passhash, level, handle, loginip)
SELECT NOW(), NOW(), UNHEX($), $, $, #, $, UNHEX($)
FROM DUAL
WHERE NOT EXISTS (
SELECT 1
FROM `qa_users`
WHERE email = $
OR handle = $
)
// is "0" IF NO ENTRY WAS CREATED
$userid_new = qa_db_last_insert_id();