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

Query time 0.00030