UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6HBeysZZ8amls4AoCRa3lMbibD3u6mwnANSrcKWxcIE=' 
WHERE 
  key_id = '3c368804fbdc5a8a8756563f37d73c13d098c57201ad0c2a9f907ca1bf6c4fb8' 
  AND (
    token = '6HBeysZZ8amls4AoCRa3lMbibD3u6mwnANSrcKWxcIE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033