UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YWFO4yFaFekjQL802oGFpTFiCowXsTwfnVL0N1AROc4=' 
WHERE 
  key_id = '36600a9c2b9a54c81c27ee5fc877caaa6e39908f54368e04e781b754297517c1' 
  AND (
    token = 'YWFO4yFaFekjQL802oGFpTFiCowXsTwfnVL0N1AROc4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00073