UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '81k0sVmeSA9WC1XIdRgE5eghxnQYxQF+E3p6SZ+tRWk=' 
WHERE 
  key_id = '647d63b61af0a6dff52c47691c15ad821aebb8e3cbb43a6670944efb91e20477' 
  AND (
    token = '81k0sVmeSA9WC1XIdRgE5eghxnQYxQF+E3p6SZ+tRWk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035