UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XJ9/N+EliPaF45dNpPnd7eGF3YwZqec+l5jhSECatsw=' 
WHERE 
  key_id = 'a22589f39e24f498c1c98862fa67e3c6fe154975abb391da5878663a10167401' 
  AND (
    token = 'XJ9/N+EliPaF45dNpPnd7eGF3YwZqec+l5jhSECatsw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029