UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eG91fvZjGFyiCudZuBje6rSXblmwstFetRpv482kTbI=' 
WHERE 
  key_id = '947c5226d6df64a5bdf45ddd25f11ca4acac95ba0411372dc92a1ace2cdb683b' 
  AND (
    token = 'eG91fvZjGFyiCudZuBje6rSXblmwstFetRpv482kTbI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00109