Try this :
sed -i '1{s/[^ ]\+\s*$//}' file test.db
If you want to delete the last word only off of the last line, then you can use:
sed -i '$s/\w*$//' test.db
If you want to delete the last word from the line for key3:
key3
sed -i '/key3/s/\w*$//' test.db
Here is an awk to remove last field:
awk
echo "one two three" | awk '{$NF="";sub(/[ \t]+$/,"")}1'one two