UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aJ4l2NLT80ecqPHHnMhzdeLsmbbD/m7YcDHHYZMl/eI=' 
WHERE 
  key_id = 'cfe1c87bebed136158acdd7504ccb647a22dec03d007ecbbd6aa959845c2cd9a' 
  AND (
    token = 'aJ4l2NLT80ecqPHHnMhzdeLsmbbD/m7YcDHHYZMl/eI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038