UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MCfAf72N1zBV39Q0WuT/fnbPSIb/mDyaaCJicqF2ILI=' 
WHERE 
  key_id = '8ee586d53efa66add24823d1df354a4933edc77c2d37adfbcc4806fbffd2a564' 
  AND (
    token = 'MCfAf72N1zBV39Q0WuT/fnbPSIb/mDyaaCJicqF2ILI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024