UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WYiSd1NK+zUTFuul2miuP0gepoBv/nFQhvU9B7btPCQ=' 
WHERE 
  key_id = 'ff392e31a4d29b7328f68df47e5852846e8becad34724743309fcdac27781575' 
  AND (
    token = 'WYiSd1NK+zUTFuul2miuP0gepoBv/nFQhvU9B7btPCQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032