okay... lets get some things straight.
Rewriterule ^categoy/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)? product_detail.php?category=$1&subcategory=$2&product=$4 [QSA,NC]
theres a lot of redundant stuff in here as for example NC does case insensitive matching anyway..
i formatted your code a bit:
RewriteMap lc int:tolower
RewriteCond %{REQUEST_URI} [A-Z]
RewriteRule (.*) ${lc:$1} [R=301,L]
which rule are you talking about now? from your title (301) i think the second one.
your rewritecondition looks weird.
but however the most common reason for an error 500 in relation to rewrite rules is lacking permissions. make sure you do AllowOverride All
in your server config or move your rules there (which gives more performance than in htaccess files)